From 20cc56f2f101a68c2be2fd4ca1457d00a01cfe95 Mon Sep 17 00:00:00 2001 From: Matt Darfeuille Date: Mon, 20 Feb 2017 18:51:50 +0100 Subject: [PATCH] Load uninstallers's common functions Signed-off-by: Matt Darfeuille Signed-off-by: Tom Eastep --- Shorewall-core/uninstall.sh | 36 ++++------------------------- Shorewall-init/uninstall.sh | 45 ++++-------------------------------- Shorewall-lite/uninstall.sh | 43 ++++------------------------------ Shorewall/uninstall.sh | 45 ++++-------------------------------- Shorewall6-lite/uninstall.sh | 45 ++++-------------------------------- Shorewall6/uninstall.sh | 45 ++++-------------------------------- 6 files changed, 29 insertions(+), 230 deletions(-) diff --git a/Shorewall-core/uninstall.sh b/Shorewall-core/uninstall.sh index d55093d32..2a12252a9 100755 --- a/Shorewall-core/uninstall.sh +++ b/Shorewall-core/uninstall.sh @@ -37,42 +37,16 @@ usage() # $1 = exit status exit $1 } -fatal_error() -{ - echo " ERROR: $@" >&2 - exit 1 -} - -qt() -{ - "$@" >/dev/null 2>&1 -} - -restore_file() # $1 = file to restore -{ - if [ -f ${1}-shorewall.bkout ]; then - if (mv -f ${1}-shorewall.bkout $1); then - echo - echo "$1 restored" - else - exit 1 - fi - fi -} - -remove_file() # $1 = file to restore -{ - if [ -f $1 -o -L $1 ] ; then - rm -f $1 - echo "$1 Removed" - fi -} - # # Change to the directory containing this script # cd "$(dirname $0)" +# +# Source common functions +# +. ./lib.uninstaller || { echo "ERROR: Can not load common functions." >&2; exit 1; } + # # Read the RC file # diff --git a/Shorewall-init/uninstall.sh b/Shorewall-init/uninstall.sh index b7cdfec1c..76de74a5c 100755 --- a/Shorewall-init/uninstall.sh +++ b/Shorewall-init/uninstall.sh @@ -37,51 +37,16 @@ usage() # $1 = exit status exit $1 } -fatal_error() -{ - echo " ERROR: $@" >&2 - exit 1 -} - -qt() -{ - "$@" >/dev/null 2>&1 -} - -split() { - local ifs - ifs=$IFS - IFS=: - set -- $1 - echo $* - IFS=$ifs -} - -mywhich() { - local dir - - for dir in $(split $PATH); do - if [ -x $dir/$1 ]; then - return 0 - fi - done - - return 2 -} - -remove_file() # $1 = file to restore -{ - if [ -f $1 -o -L $1 ] ; then - rm -f $1 - echo "$1 Removed" - fi -} - # # Change to the directory containing this script # cd "$(dirname $0)" +# +# Source common functions +# +. ./lib.uninstaller || { echo "ERROR: Can not load common functions." >&2; exit 1; } + finished=0 configure=1 diff --git a/Shorewall-lite/uninstall.sh b/Shorewall-lite/uninstall.sh index 546679f6d..853ffe7f9 100755 --- a/Shorewall-lite/uninstall.sh +++ b/Shorewall-lite/uninstall.sh @@ -41,45 +41,10 @@ usage() # $1 = exit status exit $1 } -fatal_error() -{ - echo " ERROR: $@" >&2 - exit 1 -} - -qt() -{ - "$@" >/dev/null 2>&1 -} - -split() { - local ifs - ifs=$IFS - IFS=: - set -- $1 - echo $* - IFS=$ifs -} - -mywhich() { - local dir - - for dir in $(split $PATH); do - if [ -x $dir/$1 ]; then - return 0 - fi - done - - return 2 -} - -remove_file() # $1 = file to restore -{ - if [ -f $1 -o -L $1 ] ; then - rm -f $1 - echo "$1 Removed" - fi -} +# +# Source common functions +# +. ./lib.uninstaller || { echo "ERROR: Can not load common functions." >&2; exit 1; } finished=0 configure=1 diff --git a/Shorewall/uninstall.sh b/Shorewall/uninstall.sh index eb6975da5..f291b7fd4 100755 --- a/Shorewall/uninstall.sh +++ b/Shorewall/uninstall.sh @@ -41,51 +41,16 @@ usage() # $1 = exit status exit $1 } -fatal_error() -{ - echo " ERROR: $@" >&2 - exit 1 -} - -qt() -{ - "$@" >/dev/null 2>&1 -} - -split() { - local ifs - ifs=$IFS - IFS=: - set -- $1 - echo $* - IFS=$ifs -} - -mywhich() { - local dir - - for dir in $(split $PATH); do - if [ -x $dir/$1 ]; then - return 0 - fi - done - - return 2 -} - -remove_file() # $1 = file to restore -{ - if [ -f $1 -o -L $1 ] ; then - rm -f $1 - echo "$1 Removed" - fi -} - # # Change to the directory containing this script # cd "$(dirname $0)" +# +# Source common functions +# +. ./lib.uninstaller || { echo "ERROR: Can not load common functions." >&2; exit 1; } + finished=0 configure=1 diff --git a/Shorewall6-lite/uninstall.sh b/Shorewall6-lite/uninstall.sh index 0c4495aea..6d0ee50c5 100755 --- a/Shorewall6-lite/uninstall.sh +++ b/Shorewall6-lite/uninstall.sh @@ -37,51 +37,16 @@ usage() # $1 = exit status exit $1 } -fatal_error() -{ - echo " ERROR: $@" >&2 - exit 1 -} - -qt() -{ - "$@" >/dev/null 2>&1 -} - -split() { - local ifs - ifs=$IFS - IFS=: - set -- $1 - echo $* - IFS=$ifs -} - -mywhich() { - local dir - - for dir in $(split $PATH); do - if [ -x $dir/$1 ]; then - return 0 - fi - done - - return 2 -} - -remove_file() # $1 = file to restore -{ - if [ -f $1 -o -L $1 ] ; then - rm -f $1 - echo "$1 Removed" - fi -} - # # Change to the directory containing this script # cd "$(dirname $0)" +# +# Source common functions +# +. ./lib.uninstaller || { echo "ERROR: Can not load common functions." >&2; exit 1; } + finished=0 configure=1 diff --git a/Shorewall6/uninstall.sh b/Shorewall6/uninstall.sh index f89f09f88..20ac1c291 100755 --- a/Shorewall6/uninstall.sh +++ b/Shorewall6/uninstall.sh @@ -37,51 +37,16 @@ usage() # $1 = exit status exit $1 } -fatal_error() -{ - echo " ERROR: $@" >&2 - exit 1 -} - -qt() -{ - "$@" >/dev/null 2>&1 -} - -split() { - local ifs - ifs=$IFS - IFS=: - set -- $1 - echo $* - IFS=$ifs -} - -mywhich() { - local dir - - for dir in $(split $PATH); do - if [ -x $dir/$1 ]; then - return 0 - fi - done - - return 2 -} - -remove_file() # $1 = file to restore -{ - if [ -f $1 -o -L $1 ] ; then - rm -f $1 - echo "$1 Removed" - fi -} - # # Change to the directory containing this script # cd "$(dirname $0)" +# +# Source common functions +# +. ./lib.uninstaller || { echo "ERROR: Can not load common functions." >&2; exit 1; } + finished=0 configure=1