From 00b0489047886888acf70769f163d29dbf7caf6b Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 4 Oct 2014 07:50:30 -0700 Subject: [PATCH] Implement SANDBOX variable in the installers/uninstallers Signed-off-by: Tom Eastep --- Shorewall-init/install.sh | 2 ++ Shorewall-init/uninstall.sh | 23 +++++++++++++++-------- Shorewall-lite/install.sh | 2 ++ Shorewall-lite/uninstall.sh | 9 +++++++-- Shorewall/install.sh | 2 ++ Shorewall/uninstall.sh | 9 +++++++-- 6 files changed, 35 insertions(+), 12 deletions(-) diff --git a/Shorewall-init/install.sh b/Shorewall-init/install.sh index da34880a3..13a1a3287 100755 --- a/Shorewall-init/install.sh +++ b/Shorewall-init/install.sh @@ -184,6 +184,8 @@ for var in SHAREDIR LIBEXECDIR CONFDIR SBINDIR VARLIB VARDIR; do require $var done +[ -n "$SANDBOX" ] && configure=0 + PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin if [ -z "$BUILD" ]; then diff --git a/Shorewall-init/uninstall.sh b/Shorewall-init/uninstall.sh index 3c6f50fd5..7cd391001 100755 --- a/Shorewall-init/uninstall.sh +++ b/Shorewall-init/uninstall.sh @@ -151,22 +151,29 @@ fi echo "Uninstalling Shorewall Init $VERSION" +[ -n "$SANDBOX" ] && configure=0 + INITSCRIPT=${CONFDIR}/init.d/shorewall-init if [ -f "$INITSCRIPT" ]; then - if mywhich updaterc.d ; then - updaterc.d shorewall-init remove - elif mywhich insserv ; then - insserv -r $INITSCRIPT - elif mywhich chkconfig ; then - chkconfig --del $(basename $INITSCRIPT) - elif mywhich systemctl ; then - systemctl disable shorewall-init + if [ $configure -eq 1 ]; then + if mywhich updaterc.d ; then + updaterc.d shorewall-init remove + elif mywhich insserv ; then + insserv -r $INITSCRIPT + elif mywhich chkconfig ; then + chkconfig --del $(basename $INITSCRIPT) + fi fi remove_file $INITSCRIPT fi +if [ -n "$SYSTEMD" ]; then + [ $configure -eq 1 ] && systemctl disable shorewall-init.service + rm -f $SYSTEMD/shorewall-init.service +fi + [ "$(readlink -m -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifup-local [ "$(readlink -m -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifdown-local diff --git a/Shorewall-lite/install.sh b/Shorewall-lite/install.sh index efdad0dad..347c38aac 100755 --- a/Shorewall-lite/install.sh +++ b/Shorewall-lite/install.sh @@ -195,6 +195,8 @@ done PATH=${SBINDIR}:/bin:/usr${SBINDIR}:/usr/bin:/usr/local/bin:/usr/local${SBINDIR} +[ -n "$SANDBOX" ] && configure=0 + # # Determine where to install the firewall script # diff --git a/Shorewall-lite/uninstall.sh b/Shorewall-lite/uninstall.sh index 2c840dd7c..bc8b114a0 100755 --- a/Shorewall-lite/uninstall.sh +++ b/Shorewall-lite/uninstall.sh @@ -153,6 +153,8 @@ fi echo "Uninstalling Shorewall Lite $VERSION" +[ -n "$SANDBOX" ] && configure=0 + if qt iptables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall ]; then shorewall-lite clear fi @@ -171,14 +173,17 @@ if [ -f "$FIREWALL" ]; then insserv -r $FIREWALL elif mywhich chkconfig ; then chkconfig --del $(basename $FIREWALL) - elif mywhich systemctl ; then - systemctl disable shorewall-lite fi fi remove_file $FIREWALL fi +if [ -n "$SYSTEMD" ]; then + [ $configure -eq 1 ] && systemctl disable ${PRODUCT} + rm -f $SYSTEMD/${PRODUCT}.service +fi + rm -f ${SBINDIR}/shorewall-lite rm -rf ${SBINDIR}/shorewall-lite diff --git a/Shorewall/install.sh b/Shorewall/install.sh index 02745ff5e..9761d636e 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -209,6 +209,8 @@ done [ -n "${INITFILE}" ] && require INITSOURCE && require INITDIR +[ -n "$SANDBOX" ] && configure=0 + if [ -z "$BUILD" ]; then case $(uname) in cygwin*|CYGWIN*) diff --git a/Shorewall/uninstall.sh b/Shorewall/uninstall.sh index 1db0c5dee..88cf04040 100755 --- a/Shorewall/uninstall.sh +++ b/Shorewall/uninstall.sh @@ -152,6 +152,8 @@ fi echo "Uninstalling shorewall $VERSION" +[ -n "$SANDBOX" ] && configure=0 + if qt iptables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall-lite ]; then shorewall clear fi @@ -166,14 +168,17 @@ if [ -f "$INITSCRIPT" ]; then insserv -r $INITSCRIPT elif mywhich chkconfig ; then chkconfig --del $(basename $INITSCRIPT) - elif mywhich systemctl ; then - systemctl disable ${PRODUCT} fi fi remove_file $INITSCRIPT fi +if [ -n "$SYSTEMD" ]; then + [ $configure -eq 1 ] && systemctl disable ${PRODUCT} + rm -f $SYSTEMD/${PRODUCT}.service +fi + rm -rf ${SHAREDIR}/shorewall/version rm -rf ${CONFDIR}/shorewall