diff --git a/README.md b/README.md index cf563fc..11f18cd 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ machines # SYNOPSIS **boxctl** -\[**-mnv**] +\[**-fmnsv**] \[**-h** *host*] \[**-u** *user*] @@ -39,6 +39,11 @@ The options are as follows: > Defaults to > *root*. +**-f** + +> Force installation of all packages. +> This skipps the 'intelligent' diff mode. + **-m** > Run maintenance tasks. @@ -52,6 +57,15 @@ The options are as follows: > Dry run. > This will only print the commands that will be run. +**-s** + +> Force +> pkg\_add(1) +> to run with '-Dsnap'. +> This is useful when +> OpenBSD +> is in -beta. + **-v** > Increase verbosity. diff --git a/boxctl.sh b/boxctl.sh index 7e097b1..2bc1a86 100755 --- a/boxctl.sh +++ b/boxctl.sh @@ -23,31 +23,16 @@ RUN_USER="root" VERBOSITY=0 DRY=0 MAINTENANCE=0 +SNAPSHOT="" +FORCE=0 SSH_CTL_PATH="/tmp/boxctl-%r@%h:%p" SSH_OPTS="-o ControlMaster=auto -o ControlPersist=60s -o ControlPath=${SSH_CTL_PATH}" -SERVICE_START_RESTART=$(cat < /tmp/new_packages - /usr/sbin/pkg_add %s -z -l /tmp/new_packages -else - /usr/sbin/pkg_add %s -z -l /etc/packages.tmp -fi -mv /etc/packages.tmp /etc/packages -EOF -) - -while getopts "h:mnu:v" arg; do +while getopts "fh:mnu:sv" arg; do case $arg in + f) + FORCE=1 + ;; h) SERVER=$OPTARG ;; @@ -60,12 +45,36 @@ while getopts "h:mnu:v" arg; do u) RUN_USER=$OPTARG ;; + s) + SNAPSHOT="-Dsnap" + ;; v) VERBOSITY=$((VERBOSITY+1)) ;; esac done +PKG_DIFF_INSTALL=$(cat < /tmp/new_packages + /usr/sbin/pkg_add %s ${SNAPSHOT} -z -l /tmp/new_packages +else + /usr/sbin/pkg_add %s ${SNAPSHOT} -z -l /etc/packages.tmp +fi +mv /etc/packages.tmp /etc/packages +EOF +) + +SERVICE_START_RESTART=$(cat <