aboutsummaryrefslogtreecommitdiff
path: root/boxconf
diff options
context:
space:
mode:
authorCullum Smith <cullum@sacredheartsc.com>2024-07-11 21:25:13 -0400
committerCullum Smith <cullum@sacredheartsc.com>2024-07-11 21:25:13 -0400
commit010a4bc91e745ef34175b521830f9c2b644cb0e6 (patch)
tree942b639b1a86e73679fcff312e3bf1562512ff14 /boxconf
parent23447b9622b3e39fce4737aa913f830710618adf (diff)
downloadinfrastructure-010a4bc91e745ef34175b521830f9c2b644cb0e6.tar.gz
make boxconf command line more intuitive, fix undef vars
Diffstat (limited to 'boxconf')
-rwxr-xr-xboxconf10
1 files changed, 6 insertions, 4 deletions
diff --git a/boxconf b/boxconf
index 52d8500..07e77a6 100755
--- a/boxconf
+++ b/boxconf
@@ -5,7 +5,7 @@
set -eu
PROGNAME=boxconf
-USAGE="${PROGNAME} [-d] [-e VAR=VALUE]... [-o HOSTNAME] TARGET"
+USAGE="${PROGNAME} [-d] [-e VAR=VALUE]... [-s SSH_HOST] HOSTNAME"
BOXCONF_ROOT=$(dirname "$(readlink -f "$0")")
usage(){
@@ -14,12 +14,12 @@ usage(){
exit 2
}
-while getopts :hde:o:X _bc_opt; do
+while getopts :hde:s:X _bc_opt; do
case $_bc_opt in
h) usage ;;
d) set -x ;;
e) eval "$OPTARG" ;;
- o) BOXCONF_HOSTNAME=$OPTARG ;;
+ s) BOXCONF_SSH_HOST=$OPTARG ;;
X) _bc_run=1 ;;
:) usage "missing option value: -${OPTARG}" ;;
?) usage "unknown option: -${OPTARG}" ;;
@@ -29,6 +29,8 @@ done
shift $((OPTIND - 1))
[ $# -eq 1 ] || usage
+BOXCONF_HOSTNAME=$1
+
for _bc_lib in "${BOXCONF_ROOT}/lib"/*; do
. "$_bc_lib"
done
@@ -36,5 +38,5 @@ done
if [ -n "${_bc_run:-}" ]; then
_boxconf_run
else
- _boxconf_deploy "$1" "${BOXCONF_HOSTNAME:-$1}" "$@"
+ _boxconf_deploy "${BOXCONF_SSH_HOST:-$1}" "$BOXCONF_HOSTNAME" "$@"
fi