Allow compound options in the installers

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2011-05-30 08:15:59 -07:00
parent 60d33740f6
commit 7b560eefe4
2 changed files with 72 additions and 35 deletions

View File

@ -30,6 +30,8 @@ usage() # $1 = exit status
echo "usage: $ME" echo "usage: $ME"
echo " $ME -v" echo " $ME -v"
echo " $ME -h" echo " $ME -h"
echo " $ME -s"
echo " $ME -p"
exit $1 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 # INIT is the name of the script in the $DEST directory
# ARGS is "yes" if we've already parsed an argument # ARGS is "yes" if we've already parsed an argument
# #
ARGS=""
T="-T" T="-T"
if [ -z "$DEST" ] ; then if [ -z "$DEST" ] ; then
@ -162,27 +163,45 @@ esac
OWNERSHIP="-o $OWNER -g $GROUP" OWNERSHIP="-o $OWNER -g $GROUP"
while [ $# -gt 0 ] ; do finished=0
case "$1" in
-h|help|?) while [ $finished -eq 0 ]; do
usage 0 option=$1
;;
-v) case "$option" in
echo "Shorewall Firewall Installer Version $VERSION" -*)
exit 0 option=${option#-}
;;
-s) while [ -n "$option" ]; do
SPARSE=Yes case $option in
;; h)
-p) usage 0
PLAIN=Yes ;;
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 esac
shift
ARGS="yes"
done done
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin

View File

@ -162,27 +162,45 @@ esac
OWNERSHIP="-o $OWNER -g $GROUP" OWNERSHIP="-o $OWNER -g $GROUP"
while [ $# -gt 0 ] ; do finished=0
case "$1" in
-h|help|?) while [ $finished -eq 0 ]; do
usage 0 option=$1
;;
-v) case "$option" in
echo "Shorewall6 Firewall Installer Version $VERSION" -*)
exit 0 option=${option#-}
;;
-s) while [ -n "$option" ]; do
SPARSE=Yes case $option in
;; h)
-p) usage 0
PLAIN=Yes ;;
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 esac
shift
ARGS="yes"
done done
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin