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 " $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

View File

@ -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