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
option=$1
case "$option" in
-*)
option=${option#-}
while [ -n "$option" ]; do
case $option in
h)
usage 0 usage 0
;; ;;
-v) v)
echo "Shorewall Firewall Installer Version $VERSION" echo "Shorewall Firewall Installer Version $VERSION"
exit 0 exit 0
;; ;;
-s) s*)
SPARSE=Yes SPARSE=Yes
option=${option#s}
;; ;;
-p) p*)
PLAIN=Yes PLAIN=Yes
option=${option#p}
;; ;;
*) *)
usage 1 usage 1
;; ;;
esac esac
done
shift shift
ARGS="yes" ;;
*)
[ -n "$option" ] && usage 1
finished=1
;;
esac
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
option=$1
case "$option" in
-*)
option=${option#-}
while [ -n "$option" ]; do
case $option in
h)
usage 0 usage 0
;; ;;
-v) v)
echo "Shorewall6 Firewall Installer Version $VERSION" echo "Shorewall6 Firewall Installer Version $VERSION"
exit 0 exit 0
;; ;;
-s) s*)
SPARSE=Yes SPARSE=Yes
option=${option#s}
;; ;;
-p) p*)
PLAIN=Yes PLAIN=Yes
option=${option#p}
;; ;;
*) *)
usage 1 usage 1
;; ;;
esac esac
done
shift shift
ARGS="yes" ;;
*)
[ -n "$option" ] && usage 1
finished=1
;;
esac
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