From b31f656d63f78d6e9921f57cc314aec6a526002d Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 26 Mar 2012 16:19:40 -0700 Subject: [PATCH] Update uninstall scripts for multiple .shorewallrc locations. Signed-off-by: Tom Eastep --- Shorewall-core/uninstall.sh | 18 ++++++++++++++---- Shorewall-init/uninstall.sh | 12 ++++++++++-- Shorewall-lite/uninstall.sh | 12 ++++++++++-- Shorewall/uninstall.sh | 12 ++++++++++-- Shorewall6-lite/uninstall.sh | 12 ++++++++++-- Shorewall6/uninstall.sh | 12 ++++++++++-- 6 files changed, 64 insertions(+), 14 deletions(-) diff --git a/Shorewall-core/uninstall.sh b/Shorewall-core/uninstall.sh index 3c45cd296..6fc6af188 100755 --- a/Shorewall-core/uninstall.sh +++ b/Shorewall-core/uninstall.sh @@ -60,12 +60,22 @@ remove_file() # $1 = file to restore fi } -if [ -f ~/.shorewallrc ]; then - . ~/shorewallrc || exit 1 +if [ -f ./.shorewallrc ]; then + . ./.shorewallrc || exit 1 +elif [ -f ~/.shorewallrc ]; then + . ~/.shorewallrc || exit 1 +elif [ -r /root/.shorewallrc ]; then + . /root/.shorewallrc || exit 1 +elif [ -r /.shorewallrc ]; then + . /root/.shorewallrc || exit 1 +elif - -f ${SHOREAWLLRC_HOME}/.shorewallrc; then + . ${SHOREWALLRC_HOME}/.shorewallrc || exit 1 +else + SHAREDIR=/usr/share fi -if [ -f /usr/share/shorewall/coreversion ]; then - INSTALLED_VERSION="$(cat /usr/share/shorewall/coreversion)" +if [ -f ${SHAREDIR}/shorewall/coreversion ]; then + INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall/coreversion)" if [ "$INSTALLED_VERSION" != "$VERSION" ]; then echo "WARNING: Shorewall Core Version $INSTALLED_VERSION is installed" echo " and this is the $VERSION uninstaller." diff --git a/Shorewall-init/uninstall.sh b/Shorewall-init/uninstall.sh index 42910f4e3..78ff5e754 100755 --- a/Shorewall-init/uninstall.sh +++ b/Shorewall-init/uninstall.sh @@ -69,8 +69,16 @@ remove_file() # $1 = file to restore fi } -if [ -f ~/.shorewallrc ]; then - . ~/shorewallrc || exit 1 +if [ -f ./.shorewallrc ]; then + . ./.shorewallrc || exit 1 +elif [ -f ~/.shorewallrc ]; then + . ~/.shorewallrc || exit 1 +elif [ -r /root/.shorewallrc ]; then + . /root/.shorewallrc || exit 1 +elif [ -r /.shorewallrc ]; then + . /root/.shorewallrc || exit 1 +elif - -f ${SHOREAWLLRC_HOME}/.shorewallrc; then + . ${SHOREWALLRC_HOME}/.shorewallrc || exit 1 else [ -n "${LIBEXEC:=/usr/share}" ] [ -n "${PERLLIB:=/usr/share/shorewall}" ] diff --git a/Shorewall-lite/uninstall.sh b/Shorewall-lite/uninstall.sh index be600bc5f..8454ce55c 100755 --- a/Shorewall-lite/uninstall.sh +++ b/Shorewall-lite/uninstall.sh @@ -69,8 +69,16 @@ remove_file() # $1 = file to restore fi } -if [ -f ~/.shorewallrc ]; then - . ~/shorewallrc || exit 1 +if [ -f ./.shorewallrc ]; then + . ./.shorewallrc || exit 1 +elif [ -f ~/.shorewallrc ]; then + . ~/.shorewallrc || exit 1 +elif [ -r /root/.shorewallrc ]; then + . /root/.shorewallrc || exit 1 +elif [ -r /.shorewallrc ]; then + . /root/.shorewallrc || exit 1 +elif - -f ${SHOREAWLLRC_HOME}/.shorewallrc; then + . ${SHOREWALLRC_HOME}/.shorewallrc || exit 1 else [ -n "${LIBEXEC:=/usr/share}" ] [ -n "${PERLLIB:=/usr/share/shorewall}" ] diff --git a/Shorewall/uninstall.sh b/Shorewall/uninstall.sh index 86bcfbe9d..7f96d4a07 100755 --- a/Shorewall/uninstall.sh +++ b/Shorewall/uninstall.sh @@ -69,8 +69,16 @@ remove_file() # $1 = file to restore fi } -if [ -f ~/.shorewallrc ]; then - . ~/shorewallrc || exit 1 +if [ -f ./.shorewallrc ]; then + . ./.shorewallrc || exit 1 +elif [ -f ~/.shorewallrc ]; then + . ~/.shorewallrc || exit 1 +elif [ -r /root/.shorewallrc ]; then + . /root/.shorewallrc || exit 1 +elif [ -r /.shorewallrc ]; then + . /root/.shorewallrc || exit 1 +elif - -f ${SHOREAWLLRC_HOME}/.shorewallrc; then + . ${SHOREWALLRC_HOME}/.shorewallrc || exit 1 else [ -n "${LIBEXEC:=/usr/share}" ] [ -n "${PERLLIB:=/usr/share/shorewall}" ] diff --git a/Shorewall6-lite/uninstall.sh b/Shorewall6-lite/uninstall.sh index 2adb1f7a5..eda69b81c 100755 --- a/Shorewall6-lite/uninstall.sh +++ b/Shorewall6-lite/uninstall.sh @@ -69,8 +69,16 @@ remove_file() # $1 = file to restore fi } -if [ -f ~/.shorewallrc ]; then - . ~/shorewallrc || exit 1 +if [ -f ./.shorewallrc ]; then + . ./.shorewallrc || exit 1 +elif [ -f ~/.shorewallrc ]; then + . ~/.shorewallrc || exit 1 +elif [ -r /root/.shorewallrc ]; then + . /root/.shorewallrc || exit 1 +elif [ -r /.shorewallrc ]; then + . /root/.shorewallrc || exit 1 +elif - -f ${SHOREAWLLRC_HOME}/.shorewallrc; then + . ${SHOREWALLRC_HOME}/.shorewallrc || exit 1 else [ -n "${LIBEXEC:=/usr/share}" ] [ -n "${PERLLIB:=/usr/share/shorewall}" ] diff --git a/Shorewall6/uninstall.sh b/Shorewall6/uninstall.sh index 420fef336..6ebe23283 100755 --- a/Shorewall6/uninstall.sh +++ b/Shorewall6/uninstall.sh @@ -69,8 +69,16 @@ remove_file() # $1 = file to restore fi } -if [ -f ~/.shorewallrc ]; then - . ~/shorewallrc || exit 1 +if [ -f ./.shorewallrc ]; then + . ./.shorewallrc || exit 1 +elif [ -f ~/.shorewallrc ]; then + . ~/.shorewallrc || exit 1 +elif [ -r /root/.shorewallrc ]; then + . /root/.shorewallrc || exit 1 +elif [ -r /.shorewallrc ]; then + . /root/.shorewallrc || exit 1 +elif - -f ${SHOREAWLLRC_HOME}/.shorewallrc; then + . ${SHOREWALLRC_HOME}/.shorewallrc || exit 1 else [ -n "${LIBEXEC:=/usr/share}" ] [ -n "${PERLLIB:=/usr/share/shorewall}" ]