forked from NationTech/harmony
Provide diagrams for a Virtualized Execution Environment Propose interfaces for a cli toolkit
106 lines
1.7 KiB
Plaintext
Executable File
106 lines
1.7 KiB
Plaintext
Executable File
|
|
#! /bin/bash
|
|
|
|
harmony-ve()(
|
|
|
|
set -eu
|
|
|
|
[ "${1:-}" != "-d" ] || { set -x ; shift ; }
|
|
trap '[ "$?" = "0" ] || >&2 echo ABNORMAL TERMINATION' EXIT
|
|
|
|
SCRIPTS_DIR=$(readlink -f "$(dirname "${BASH_SOURCE}")")
|
|
. "${SCRIPTS_DIR}/common"
|
|
|
|
_short_help(){
|
|
|
|
cat <<-EOM
|
|
|
|
NAME
|
|
|
|
harmony-ve
|
|
|
|
DESCRIPTION
|
|
|
|
CLI management toolkit for Harmony Virtualized Execution Environment
|
|
|
|
SYNOPSYS
|
|
|
|
harmony-ve [GLOBAL_OPTIONS] COMMAND [OPTIONS]
|
|
|
|
harmony-ve dependencies # manage localhost depend
|
|
harmony-ve network # manage localhost netork
|
|
|
|
harmony-ve opnsense-img-src # manage opnsense OS source images
|
|
harmony-ve opnsense-img # manage opnsense OS images
|
|
|
|
harmony-ve vm # manage vm
|
|
|
|
EOM
|
|
|
|
}
|
|
|
|
_extra_help(){
|
|
|
|
cat <<-EOM
|
|
|
|
DESCRIPTION
|
|
|
|
Automation CLI to easily provision and manage a Virtualized Execution Environment for testing and learning Harmony.
|
|
|
|
This tool allows:
|
|
- new harmony users to start testing within 15 minutes on their development desktop
|
|
- automate virtualized test in pipeline
|
|
|
|
GLOBAL_OPTIONS
|
|
|
|
-d Debug mode.
|
|
|
|
WARNINGS
|
|
|
|
This script is experimetal. Use with caution.
|
|
EOM
|
|
|
|
|
|
}
|
|
|
|
|
|
# Implement functions
|
|
|
|
case "${1:-}" in
|
|
|
|
"")
|
|
_short_help
|
|
;;
|
|
-h|--help)
|
|
_short_help
|
|
_extra_help
|
|
;;
|
|
# Commands entrypoints
|
|
deps|dependencies)
|
|
harmony-ve-dependencies "${@:2}"
|
|
;;
|
|
net|network)
|
|
harmony-ve-network"${@:2}"
|
|
;;
|
|
img-src|opnsense-img-src)
|
|
harmony-ve-opnsense-img-src "${@:2}"
|
|
;;
|
|
img|opnsense-img)
|
|
harmony-ve-opnsense-img "${@:2}"
|
|
;;
|
|
vm)
|
|
harmony-ve-vm "${@:2}"
|
|
;;
|
|
|
|
*)
|
|
_warn "Unknown COMMAND '$1'"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
)
|
|
|
|
|
|
[ "$0" != "${BASH_SOURCE}" ] || harmony-ve "${@}"
|
|
|