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:
81
examples/opnsense/scripts/harmony-ve-opnsense-img
Executable file
81
examples/opnsense/scripts/harmony-ve-opnsense-img
Executable file
@@ -0,0 +1,81 @@
|
||||
|
||||
#! /bin/bash
|
||||
|
||||
harmony-ve-opnsense-img()(
|
||||
|
||||
set -eu
|
||||
|
||||
[ "${1:-}" != "-d" ] || { set -x ; shift ; }
|
||||
trap '[ "$?" = "0" ] || >&2 echo ABNORMAL TERMINATION' EXIT
|
||||
|
||||
SCRIPTS_DIR=$(readlink -f "$(dirname "${BASH_SOURCE}")")
|
||||
. "${SCRIPTS_DIR}/common"
|
||||
|
||||
DEFAULT_KVM_IMG_DIR=/var/lib/libvirt/images
|
||||
KVM_IMG_DIR=${KVM_IMG_DIR:-$DEFAULT_KVM_IMG_DIR}
|
||||
[ -d "$KVM_IMG_DIR" ] || mkdir -p "${KVM_IMG_DIR}"
|
||||
|
||||
|
||||
_short_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
NAME
|
||||
|
||||
harmony-ve-opnsense-img
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Manage opnsense images needed by Harmony Virtual Execution Environment
|
||||
SYNOPSYS
|
||||
|
||||
harmony-vee-opnsense-img [GLOBAL_OPTIONS] COMMAND [OPTIONS]
|
||||
|
||||
harmony-vee-opnsense-img list [--remote]
|
||||
harmony-vee-opnsense-img new NAME
|
||||
harmony-vee-opnsense-img update NAME
|
||||
harmony-vee-opnsense-img delete [NAME]
|
||||
|
||||
EOM
|
||||
|
||||
}
|
||||
|
||||
_extra_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
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
|
||||
*)
|
||||
_warn "Unknown COMMAND '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
)
|
||||
|
||||
|
||||
[ "$0" != "${BASH_SOURCE}" ] || harmony-ve-opnsense-img "${@}"
|
||||
|
||||
Reference in New Issue
Block a user