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 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 # Read the RC file
# #

View File

@ -31,7 +31,11 @@ VERSION=xxx #The Build script inserts the actual version
usage() # $1 = exit status usage() # $1 = exit status
{ {
ME=$(basename $0) 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 exit $1
} }
@ -69,6 +73,43 @@ remove_file() # $1 = file to restore
fi 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 # Read the RC file
# #
@ -123,14 +164,16 @@ elif [ -n "$INITFILE" ]; then
fi fi
if [ -f "$FIREWALL" ]; then if [ -f "$FIREWALL" ]; then
if mywhich updaterc.d ; then if [ $configure -eq 1 ]; then
updaterc.d shorewall-lite remove if mywhich updaterc.d ; then
elif mywhich insserv ; then updaterc.d shorewall-lite remove
insserv -r $FIREWALL elif mywhich insserv ; then
elif mywhich chkconfig ; then insserv -r $FIREWALL
chkconfig --del $(basename $FIREWALL) elif mywhich chkconfig ; then
elif mywhich systemctl ; then chkconfig --del $(basename $FIREWALL)
systemctl disable shorewall-lite elif mywhich systemctl ; then
systemctl disable shorewall-lite
fi
fi fi
remove_file $FIREWALL remove_file $FIREWALL

View File

@ -31,7 +31,11 @@ VERSION=xxx #The Build script inserts the actual version
usage() # $1 = exit status usage() # $1 = exit status
{ {
ME=$(basename $0) 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 exit $1
} }
@ -69,6 +73,44 @@ remove_file() # $1 = file to restore
fi 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 [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
. ./shorewallrc . ./shorewallrc
@ -117,14 +159,16 @@ fi
rm -f ${SBINDIR}/shorewall rm -f ${SBINDIR}/shorewall
if [ -f "$INITSCRIPT" ]; then if [ -f "$INITSCRIPT" ]; then
if mywhich updaterc.d ; then if [ $configure -eq 1 ]; then
updaterc.d ${PRODUCT} remove if mywhich updaterc.d ; then
elif mywhich insserv ; then updaterc.d ${PRODUCT} remove
insserv -r $INITSCRIPT elif mywhich insserv ; then
elif mywhich chkconfig ; then insserv -r $INITSCRIPT
chkconfig --del $(basename $INITSCRIPT) elif mywhich chkconfig ; then
elif mywhich systemctl ; then chkconfig --del $(basename $INITSCRIPT)
systemctl disable ${PRODUCT} elif mywhich systemctl ; then
systemctl disable ${PRODUCT}
fi
fi fi
remove_file $INITSCRIPT remove_file $INITSCRIPT