From 9dc2bba0253a9415bc3ca16ac195af151680d560 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 4 Oct 2014 09:39:03 -0700 Subject: [PATCH] More uninstall corrections. Signed-off-by: Tom Eastep --- Shorewall-lite/uninstall.sh | 5 ++- Shorewall/uninstall.sh | 5 +-- Shorewall6-lite/uninstall.sh | 68 ++++++++++++++++++++++++++++++------ Shorewall6/uninstall.sh | 67 +++++++++++++++++++++++++++++------ 4 files changed, 120 insertions(+), 25 deletions(-) diff --git a/Shorewall-lite/uninstall.sh b/Shorewall-lite/uninstall.sh index 5df61962e..b512a5c2c 100755 --- a/Shorewall-lite/uninstall.sh +++ b/Shorewall-lite/uninstall.sh @@ -27,6 +27,7 @@ # shown below. Simply run this script to remove Shorewall Firewall VERSION=xxx #The Build script inserts the actual version +PRODUCT=shorewall-lite usage() # $1 = exit status { @@ -182,17 +183,15 @@ fi if [ -n "$SYSTEMD" ]; then [ $configure -eq 1 ] && systemctl disable ${PRODUCT} - rm -f $SYSTEMD/${PRODUCT}.service + rm -f $SYSTEMD/shorewall-lite.service fi rm -f ${SBINDIR}/shorewall-lite -rm -rf ${SBINDIR}/shorewall-lite rm -rf ${VARDIR}/shorewall-lite rm -rf ${SHAREDIR}/shorewall-lite rm -rf ${LIBEXEC}/shorewall-lite rm -f ${CONFDIR}/logrotate.d/shorewall-lite -[ -n "$SYSTEMD" ] && rm -f ${SYSTEMD}/shorewall-lite.service echo "Shorewall Lite Uninstalled" diff --git a/Shorewall/uninstall.sh b/Shorewall/uninstall.sh index e43e4ad02..b862a12f3 100755 --- a/Shorewall/uninstall.sh +++ b/Shorewall/uninstall.sh @@ -27,6 +27,7 @@ # shown below. Simply run this script to remove Shorewall Firewall VERSION=xxx #The Build script inserts the actual version +PRODUCT=shorewall usage() # $1 = exit status { @@ -177,7 +178,7 @@ fi if [ -n "$SYSTEMD" ]; then [ $configure -eq 1 ] && systemctl disable ${PRODUCT} - rm -f $SYSTEMD/${PRODUCT}.service + rm -f $SYSTEMD/shorewall.service fi rm -rf ${SHAREDIR}/shorewall/version @@ -189,7 +190,7 @@ if [ -n "$SYSCONFDIR" ]; then fi rm -rf ${VARDIR}/shorewall -rm -rf ${PERLLIB}/Shorewall/* +rm -rf ${PERLLIBDIR}/Shorewall/* rm -rf ${LIBEXEC}/shorewall rm -rf ${SHAREDIR}/shorewall/configfiles/ rm -rf ${SHAREDIR}/shorewall/Samples/ diff --git a/Shorewall6-lite/uninstall.sh b/Shorewall6-lite/uninstall.sh index ae0a5a398..ae77aa3f6 100755 --- a/Shorewall6-lite/uninstall.sh +++ b/Shorewall6-lite/uninstall.sh @@ -27,6 +27,7 @@ # shown below. Simply run this script to remove Shorewall Firewall VERSION=xxx #The Build script inserts the actual version +PRODUCT=shorewall6-lite usage() # $1 = exit status { @@ -69,6 +70,42 @@ 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 # @@ -112,8 +149,12 @@ fi echo "Uninstalling Shorewall Lite $VERSION" -if qt ip6tables -L shorewall -n && [ ! -f ${SBINDIR)/shorewall6 ]; then - ${SBINDIR}/shorewall6-lite clear +[ -n "$SANDBOX" ] && configure=0 + +if [ $configure -eq 1 ]; then + if qt ip6tables -L shorewall -n && [ ! -f ${SBINDIR)/shorewall6 ]; then + ${SBINDIR}/shorewall6-lite clear + fi fi if [ -l ${SHAREDIR}/shorewall6-lite/init ]; then @@ -123,19 +164,26 @@ elif [ -n "$INITFILE" ]; then fi if [ -f "$FIREWALL" ]; then - if mywhich updaterc.d ; then - updaterc.d shorewall6-lite remove - elif mywhich insserv ; then - insserv -r $FIREWALL - elif mywhich chkconfig ; then - chkconfig --del $(basename $FIREWALL) - elif mywhich systemctl ; then - systemctl disable shorewall6-lite + if [ $configure -eq 1 ]; then + if mywhich updaterc.d ; then + updaterc.d shorewall6-lite remove + elif mywhich insserv ; then + insserv -r $FIREWALL + elif mywhich chkconfig ; then + chkconfig --del $(basename $FIREWALL) + elif mywhich systemctl ; then + systemctl disable shorewall6-lite + fi fi remove_file $FIREWALL fi +if [ -n "$SYSTEMD" ]; then + [ $configure -eq 1 ] && systemctl disable ${PRODUCT} + rm -f $SYSTEMD/shorewall6-lite.service +fi + rm -f ${SBINDIR}/shorewall6-lite rm -rf ${CONFDIR}/shorewall6-lite rm -rf ${VARDIR}/shorewall6-lite diff --git a/Shorewall6/uninstall.sh b/Shorewall6/uninstall.sh index 1cb7946cc..9f1fac48a 100755 --- a/Shorewall6/uninstall.sh +++ b/Shorewall6/uninstall.sh @@ -27,6 +27,7 @@ # shown below. Simply run this script to remove Shorewall Firewall VERSION=xxx #The Build script inserts the actual version +PRODUCT=shorewall6 usage() # $1 = exit status { @@ -69,6 +70,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 # @@ -112,8 +150,12 @@ fi echo "Uninstalling shorewall6 $VERSION" -if qt ip6tables -L shorewall6 -n && [ ! -f ${SBINDIR}/shorewall6-lite ]; then - ${SBINDIR}/shorewall6 clear +[ -n "$SANDBOX" ] && configure=0 + +if [ $configure -eq 1 ]; then + if qt ip6tables -L shorewall6 -n && [ ! -f ${SBINDIR}/shorewall6-lite ]; then + ${SBINDIR}/shorewall6 clear + fi fi if [ -L ${SHAREDIR}/shorewall6/init ]; then @@ -123,19 +165,24 @@ elif [ -n "$INITFILE" ]; then fi if [ -f "$FIREWALL" ]; then - if mywhich updaterc.d ; then - updaterc.d shorewall6 remove - elif mywhich insserv ; then - insserv -r $FIREWALL - elif mywhich chkconfig ; then - chkconfig --del $(basename $FIREWALL) - elif mywhich systemctl ; then - systemctl disable shorewall6 + if [ $configure -eq 1 ]; then + if mywhich updaterc.d ; then + updaterc.d shorewall6 remove + elif mywhich insserv ; then + insserv -r $FIREWALL + elif mywhich chkconfig ; then + chkconfig --del $(basename $FIREWALL) + fi fi remove_file $FIREWALL fi +if [ -n "$SYSTEMD" ]; then + [ $configure -eq 1 ] && systemctl disable ${PRODUCT} + rm -f $SYSTEMD/shorewall6.service +fi + rm -f ${SBINDIR}/shorewall6 rm -rf ${CONFDIR}/shorewall6 rm -rf ${VARDIR}/shorewall6