Files
harmony/examples/opnsense/scripts/harmony-ve-opnsense-img
Jérémy Viau-Trudel e80ad70a4f Design learning tools
Provide diagrams for a Virtualized Execution Environment

Propose interfaces for a cli toolkit
2025-11-06 17:17:51 -05:00

82 lines
1.2 KiB
Plaintext
Executable File

#! /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 "${@}"