From 178a7f83bc993aea588762eefc7d4330069abcbb Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 21 Nov 2015 12:53:24 -0800 Subject: [PATCH] Install/uninstall fixes from Matt Darfeuille Signed-off-by: Tom Eastep --- Shorewall-init/install.sh | 10 ++++++++-- Shorewall-init/uninstall.sh | 14 ++++++++++---- Shorewall/uninstall.sh | 14 ++++++++------ Shorewall6/uninstall.sh | 13 +++++++++++-- 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/Shorewall-init/install.sh b/Shorewall-init/install.sh index ee96b8a0b..17535ebcc 100755 --- a/Shorewall-init/install.sh +++ b/Shorewall-init/install.sh @@ -397,6 +397,7 @@ if [ $HOST = debian ]; then [ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/default install_file sysconfig ${DESTDIR}${ETC}/default/shorewall-init 0644 + echo "sysconfig file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}" fi IFUPDOWN=ifupdown.debian.sh @@ -490,7 +491,12 @@ esac if [ -z "$DESTDIR" ]; then if [ $configure -eq 1 -a -n "$first_install" ]; then if [ $HOST = debian ]; then - if mywhich insserv; then + if [ -n "$SERVICEDIR" ]; then + if systemctl enable ${PRODUCT}.service; then + echo "Shorewall Init will start automatically at +boot" + fi + elif mywhich insserv; then if insserv ${INITDIR}/shorewall-init; then echo "Shorewall Init will start automatically at boot" else @@ -554,7 +560,7 @@ fi [ -z "${DESTDIR}" ] && [ ! -f ~/.shorewallrc ] && cp ${SHAREDIR}/shorewall/shorewallrc . -if [ -f ${DESTDIR}/etc/ppp ]; then +if [ -d ${DESTDIR}/etc/ppp ]; then case $HOST in debian|suse) for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do diff --git a/Shorewall-init/uninstall.sh b/Shorewall-init/uninstall.sh index f926265c0..f9518a7e7 100755 --- a/Shorewall-init/uninstall.sh +++ b/Shorewall-init/uninstall.sh @@ -174,9 +174,13 @@ if [ -f "$INITSCRIPT" ]; then remove_file $INITSCRIPT fi -if [ -n "$SYSTEMD" ]; then +if [ -z "${SERVICEDIR}" ]; then + SERVICEDIR="$SYSTEMD" +fi + +if [ -n "$SERVICEDIR" ]; then [ $configure -eq 1 ] && systemctl disable shorewall-init.service - rm -f $SYSTEMD/shorewall-init.service + rm -f $SERVICEDIR/shorewall-init.service fi [ "$(readlink -m -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifup-local @@ -202,8 +206,10 @@ if [ -d ${CONFDIR}/ppp ]; then done for file in if-up.local if-down.local; do - if grep -qF Shorewall-based ${CONFDIR}/ppp/$FILE; then - remove_file ${CONFDIR}/ppp/$FILE + if [ -f ${CONFDIR}/ppp/$file ]; then + if grep -qF Shorewall-based ${CONFDIR}/ppp/$FILE; then + remove_file ${CONFDIR}/ppp/$FILE + fi fi done fi diff --git a/Shorewall/uninstall.sh b/Shorewall/uninstall.sh index 2b31f4fce..bcade9df5 100755 --- a/Shorewall/uninstall.sh +++ b/Shorewall/uninstall.sh @@ -168,8 +168,8 @@ fi rm -f ${SBINDIR}/shorewall -if [ -L ${SHAREDIR}/shorewall6/init ]; then - FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall6/init) +if [ -L ${SHAREDIR}/shorewall/init ]; then + FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall/init) elif [ -n "$INITFILE" ]; then FIREWALL=${INITDIR}/${INITFILE} fi @@ -188,17 +188,19 @@ if [ -f "$FIREWALL" ]; then remove_file $FIREWALL fi -if [ -n "$SYSTEMD" ]; then +if [ -z "${SERVICEDIR}" ]; then + SERVICEDIR="$SYSTEMD" +fi +if [ -n "$SERVICEDIR" ]; then [ $configure -eq 1 ] && systemctl disable ${PRODUCT} - rm -f $SYSTEMD/shorewall.service + rm -f $SERVICEDIR/shorewall.service fi rm -rf ${SHAREDIR}/shorewall/version rm -rf ${CONFDIR}/shorewall if [ -n "$SYSCONFDIR" ]; then - [ -n "$SYSCONFFILE" ] || SYSCONFFILE=${PRODUCT}; - rm -f ${SYSCONFDIR}/${SYSCONFFILE} + [ -n "$SYSCONFFILE" ] && rm -f ${SYSCONFDIR}/${PRODUCT} fi rm -rf ${VARDIR}/shorewall diff --git a/Shorewall6/uninstall.sh b/Shorewall6/uninstall.sh index e6b69f123..4e8d37bd0 100755 --- a/Shorewall6/uninstall.sh +++ b/Shorewall6/uninstall.sh @@ -184,9 +184,18 @@ if [ -f "$FIREWALL" ]; then remove_file $FIREWALL fi -if [ -n "$SYSTEMD" ]; then +[ -n "$SERVICEDIR" ] || SERVICEDIR=${SYSTEMD} + +if [ -n "$SERVICEDIR" ]; then [ $configure -eq 1 ] && systemctl disable ${PRODUCT} - rm -f $SYSTEMD/shorewall6.service + rm -f $SERVICEDIR/shorewall6.service +fi + +rm -rf ${SHAREDIR}/shorewall6/version +rm -rf ${CONFDIR}/shorewall6 + +if [ -n "$SYSCONFDIR" ]; then + [ -n "$SYSCONFFILE" ] && rm -f ${SYSCONFDIR}/${PRODUCT} fi rm -f ${SBINDIR}/shorewall6