forked from NationTech/harmony
Design learning tools
Provide diagrams for a Virtualized Execution Environment Propose interfaces for a cli toolkit
This commit is contained in:
105
examples/opnsense/scripts/harmony-ve
Executable file
105
examples/opnsense/scripts/harmony-ve
Executable file
@@ -0,0 +1,105 @@
|
||||
|
||||
#! /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 "${@}"
|
||||
|
||||
Reference in New Issue
Block a user