Add -n option to the uninstallers.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2014-10-03 17:10:36 -07:00
parent 5e81bdfe19
commit f9a21bd90e
3 changed files with 142 additions and 18 deletions

View File

@ -69,6 +69,43 @@ remove_file() # $1 = file to restore
fi
}
finished=0
configure=1
while [ $finished -eq 0 ]; do
option=$1
case "$option" in
-*)
option=${option#-}
while [ -n "$option" ]; do
case $option in
h)
usage 0
;;
v)
echo "$Product Firewall Installer Version $VERSION"
exit 0
;;
;;
n*)
configure=0
option=${option#n}
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
#
# Read the RC file
#

View File

@ -31,7 +31,11 @@ VERSION=xxx #The Build script inserts the actual version
usage() # $1 = exit status
{
ME=$(basename $0)
echo "usage: $ME [ <shorewallrc file> ]"
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
echo "where <option> is one of"
echo " -h"
echo " -v"
echo " -n"
exit $1
}
@ -69,6 +73,43 @@ remove_file() # $1 = file to restore
fi
}
finished=0
configure=1
while [ $finished -eq 0 ]; do
option=$1
case "$option" in
-*)
option=${option#-}
while [ -n "$option" ]; do
case $option in
h)
usage 0
;;
v)
echo "$Product Firewall Installer Version $VERSION"
exit 0
;;
;;
n*)
configure=0
option=${option#n}
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
#
# Read the RC file
#
@ -123,6 +164,7 @@ elif [ -n "$INITFILE" ]; then
fi
if [ -f "$FIREWALL" ]; then
if [ $configure -eq 1 ]; then
if mywhich updaterc.d ; then
updaterc.d shorewall-lite remove
elif mywhich insserv ; then
@ -132,6 +174,7 @@ if [ -f "$FIREWALL" ]; then
elif mywhich systemctl ; then
systemctl disable shorewall-lite
fi
fi
remove_file $FIREWALL
fi

View File

@ -31,7 +31,11 @@ VERSION=xxx #The Build script inserts the actual version
usage() # $1 = exit status
{
ME=$(basename $0)
echo "usage: $ME [ <shorewallrc file> ]"
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
echo "where <option> is one of"
echo " -h"
echo " -v"
echo " -n"
exit $1
}
@ -69,6 +73,44 @@ remove_file() # $1 = file to restore
fi
}
finished=0
configure=1
while [ $finished -eq 0 ]; do
option=$1
case "$option" in
-*)
option=${option#-}
while [ -n "$option" ]; do
case $option in
h)
usage 0
;;
v)
echo "$Product Firewall Installer Version $VERSION"
exit 0
;;
;;
n*)
configure=0
option=${option#n}
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then
. ./shorewallrc
@ -117,6 +159,7 @@ fi
rm -f ${SBINDIR}/shorewall
if [ -f "$INITSCRIPT" ]; then
if [ $configure -eq 1 ]; then
if mywhich updaterc.d ; then
updaterc.d ${PRODUCT} remove
elif mywhich insserv ; then
@ -126,6 +169,7 @@ if [ -f "$INITSCRIPT" ]; then
elif mywhich systemctl ; then
systemctl disable ${PRODUCT}
fi
fi
remove_file $INITSCRIPT
fi