From 7b560eefe486b43188720161f6701c8d62febea8 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 30 May 2011 08:15:59 -0700 Subject: [PATCH] Allow compound options in the installers Signed-off-by: Tom Eastep --- Shorewall/install.sh | 55 +++++++++++++++++++++++++++++-------------- Shorewall6/install.sh | 52 +++++++++++++++++++++++++++------------- 2 files changed, 72 insertions(+), 35 deletions(-) diff --git a/Shorewall/install.sh b/Shorewall/install.sh index 6fc7a2434..2437a1e4a 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -30,6 +30,8 @@ usage() # $1 = exit status echo "usage: $ME" echo " $ME -v" echo " $ME -h" + echo " $ME -s" + echo " $ME -p" exit $1 } @@ -94,7 +96,6 @@ install_file() # $1 = source $2 = target $3 = mode # INIT is the name of the script in the $DEST directory # ARGS is "yes" if we've already parsed an argument # -ARGS="" T="-T" if [ -z "$DEST" ] ; then @@ -162,27 +163,45 @@ esac OWNERSHIP="-o $OWNER -g $GROUP" -while [ $# -gt 0 ] ; do - case "$1" in - -h|help|?) - usage 0 - ;; - -v) - echo "Shorewall Firewall Installer Version $VERSION" - exit 0 - ;; - -s) - SPARSE=Yes - ;; - -p) - PLAIN=Yes +finished=0 + +while [ $finished -eq 0 ]; do + option=$1 + + case "$option" in + -*) + option=${option#-} + + while [ -n "$option" ]; do + case $option in + h) + usage 0 + ;; + v) + echo "Shorewall Firewall Installer Version $VERSION" + exit 0 + ;; + s*) + SPARSE=Yes + option=${option#s} + ;; + p*) + PLAIN=Yes + option=${option#p} + ;; + *) + usage 1 + ;; + esac + done + + shift ;; *) - usage 1 + [ -n "$option" ] && usage 1 + finished=1 ;; esac - shift - ARGS="yes" done PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin diff --git a/Shorewall6/install.sh b/Shorewall6/install.sh index 7615ce9b8..68c9b2f99 100755 --- a/Shorewall6/install.sh +++ b/Shorewall6/install.sh @@ -162,27 +162,45 @@ esac OWNERSHIP="-o $OWNER -g $GROUP" -while [ $# -gt 0 ] ; do - case "$1" in - -h|help|?) - usage 0 - ;; - -v) - echo "Shorewall6 Firewall Installer Version $VERSION" - exit 0 - ;; - -s) - SPARSE=Yes - ;; - -p) - PLAIN=Yes +finished=0 + +while [ $finished -eq 0 ]; do + option=$1 + + case "$option" in + -*) + option=${option#-} + + while [ -n "$option" ]; do + case $option in + h) + usage 0 + ;; + v) + echo "Shorewall6 Firewall Installer Version $VERSION" + exit 0 + ;; + s*) + SPARSE=Yes + option=${option#s} + ;; + p*) + PLAIN=Yes + option=${option#p} + ;; + *) + usage 1 + ;; + esac + done + + shift ;; *) - usage 1 + [ -n "$option" ] && usage 1 + finished=1 ;; esac - shift - ARGS="yes" done PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin