mirror of
https://gitlab.com/shorewall/code.git
synced 2025-03-10 12:28:50 +01:00
Correct uninstall scripts
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
85fce606dc
commit
a11e2dd452
@ -60,23 +60,35 @@ remove_file() # $1 = file to restore
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Read the RC file
|
||||||
|
#
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
file=/usr/share/shorewall/shorewallrc
|
if [ -f ./shorewallrc ]; then
|
||||||
|
. ./shorewallrc
|
||||||
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
|
. ~/.shorewallrc || exit 1
|
||||||
|
file=./.shorewallrc
|
||||||
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
|
. /usr/share/shorewall/shorewallrc
|
||||||
|
else
|
||||||
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
|
fi
|
||||||
elif [ $# -eq 1 ]; then
|
elif [ $# -eq 1 ]; then
|
||||||
file=$1
|
file=$1
|
||||||
|
case $file in
|
||||||
|
/*|.*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
file=./$file
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
. $file
|
||||||
else
|
else
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$file" ]; then
|
|
||||||
. "$file"
|
|
||||||
else
|
|
||||||
echo "File $file not found" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
. $file || exit 1
|
|
||||||
|
|
||||||
if [ -f ${SHAREDIR}/shorewall/coreversion ]; then
|
if [ -f ${SHAREDIR}/shorewall/coreversion ]; then
|
||||||
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall/coreversion)"
|
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall/coreversion)"
|
||||||
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
|
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
|
||||||
|
@ -69,23 +69,35 @@ remove_file() # $1 = file to restore
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Read the RC file
|
||||||
|
#
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
file=/usr/share/shorewall/shorewallrc
|
if [ -f ./shorewallrc ]; then
|
||||||
|
. ./shorewallrc
|
||||||
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
|
. ~/.shorewallrc || exit 1
|
||||||
|
file=./.shorewallrc
|
||||||
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
|
. /usr/share/shorewall/shorewallrc
|
||||||
|
else
|
||||||
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
|
fi
|
||||||
elif [ $# -eq 1 ]; then
|
elif [ $# -eq 1 ]; then
|
||||||
file=$1
|
file=$1
|
||||||
|
case $file in
|
||||||
|
/*|.*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
file=./$file
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
. $file || exit 1
|
||||||
else
|
else
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$file" ]; then
|
|
||||||
. "$file"
|
|
||||||
else
|
|
||||||
echo "File $file not found" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
. $file || exit 1
|
|
||||||
|
|
||||||
if [ -f ${SHAREDIR}/shorewall-init/version ]; then
|
if [ -f ${SHAREDIR}/shorewall-init/version ]; then
|
||||||
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall-init/version)"
|
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall-init/version)"
|
||||||
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
|
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
|
||||||
|
@ -69,21 +69,35 @@ remove_file() # $1 = file to restore
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Read the RC file
|
||||||
|
#
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
file=/usr/share/shorewall/shorewallrc
|
if [ -f ./shorewallrc ]; then
|
||||||
|
. ./shorewallrc
|
||||||
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
|
. ~/.shorewallrc || exit 1
|
||||||
|
file=./.shorewallrc
|
||||||
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
|
. /usr/share/shorewall/shorewallrc
|
||||||
|
else
|
||||||
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
|
fi
|
||||||
elif [ $# -eq 1 ]; then
|
elif [ $# -eq 1 ]; then
|
||||||
file=$1
|
file=$1
|
||||||
|
case $file in
|
||||||
|
/*|.*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
file=./$file
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
. $file
|
||||||
else
|
else
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$file" ]; then
|
|
||||||
. "$file"
|
|
||||||
else
|
|
||||||
echo "File $file not found" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f ${SHAREDIR}/shorewall-lite/version ]; then
|
if [ -f ${SHAREDIR}/shorewall-lite/version ]; then
|
||||||
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall-lite/version)"
|
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall-lite/version)"
|
||||||
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
|
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
|
||||||
|
@ -31,7 +31,7 @@ VERSION=xxx #The Build script inserts the actual version
|
|||||||
usage() # $1 = exit status
|
usage() # $1 = exit status
|
||||||
{
|
{
|
||||||
ME=$(basename $0)
|
ME=$(basename $0)
|
||||||
echo "usage: $ME"
|
echo "usage: $ME [ <shorewallrc file> ]"
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,35 +69,30 @@ remove_file() # $1 = file to restore
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -f ./.shorewallrc ]; then
|
if [ $# -eq 0 ]; then
|
||||||
. ./.shorewallrc || exit 1
|
if [ -f ./shorewallrc ]; then
|
||||||
|
. ./shorewallrc
|
||||||
elif [ -f ~/.shorewallrc ]; then
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
. ~/.shorewallrc || exit 1
|
. ~/.shorewallrc || exit 1
|
||||||
elif [ -r /root/.shorewallrc ]; then
|
file=./.shorewallrc
|
||||||
. /root/.shorewallrc || exit 1
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
elif [ -r /.shorewallrc ]; then
|
. /usr/share/shorewall/shorewallrc
|
||||||
. /root/.shorewallrc || exit 1
|
|
||||||
elif - -f ${SHOREAWLLRC_HOME}/.shorewallrc; then
|
|
||||||
. ${SHOREWALLRC_HOME}/.shorewallrc || exit 1
|
|
||||||
else
|
else
|
||||||
[ -n "${LIBEXEC:=/usr/share}" ]
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
[ -n "${PERLLIB:=/usr/share/shorewall}" ]
|
fi
|
||||||
[ -n "${CONFDIR:=/etc}" ]
|
elif [ $# -eq 1 ]; then
|
||||||
|
file=$1
|
||||||
|
case $file in
|
||||||
|
/*|.*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
file=./$file
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ -z "$SYSCONFDIR" ]; then
|
. $file
|
||||||
if [ -d /etc/default ]; then
|
|
||||||
SYSCONFDIR=/etc/default
|
|
||||||
else
|
else
|
||||||
SYSCONFDIR=/etc/sysconfig
|
usage 1
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -n "${SBINDIR:=/sbin}" ]
|
|
||||||
[ -n "${SHAREDIR:=/usr/share}" ]
|
|
||||||
[ -n "${VARDIR:=/var/lib}" ]
|
|
||||||
[ -n "${INITFILE:=shorewall}" ]
|
|
||||||
[ -n "${INITDIR:=/etc/init.d}" ]
|
|
||||||
[ -n "${MANDIR:=/usr/share/man}" ]
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f ${SHAREDIR}/shorewall/version ]; then
|
if [ -f ${SHAREDIR}/shorewall/version ]; then
|
||||||
@ -119,27 +114,6 @@ if qt iptables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall-lite ]; then
|
|||||||
shorewall clear
|
shorewall clear
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -L ${SHAREDIR}/shorewall/init ]; then
|
|
||||||
FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall/init)
|
|
||||||
elif [ -n "$INITFILE" ]; then
|
|
||||||
FIREWALL=/${INITDIR}/${INITFILE}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$FIREWALL" ]; then
|
|
||||||
if mywhich updaterc.d; then
|
|
||||||
updaterc.d shorewall remove
|
|
||||||
elif mywhich insserv; then
|
|
||||||
insserv -r $FIREWALL
|
|
||||||
elif mywhich systemctl; then
|
|
||||||
systemctl disable shorewall
|
|
||||||
elif mywhich chkconfig; then
|
|
||||||
chkconfig --del $(basename $FIREWALL)
|
|
||||||
fi
|
|
||||||
|
|
||||||
remove_file $FIREWALL
|
|
||||||
[ -f "$AUXINITFILE" ] && remove_file ${INITDIR}/{$AUXINITFILE}
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f ${SBINDIR}/shorewall
|
rm -f ${SBINDIR}/shorewall
|
||||||
|
|
||||||
rm -rf ${SHAREDIR}/shorewall/version
|
rm -rf ${SHAREDIR}/shorewall/version
|
||||||
|
@ -31,7 +31,7 @@ VERSION=xxx #The Build script inserts the actual version
|
|||||||
usage() # $1 = exit status
|
usage() # $1 = exit status
|
||||||
{
|
{
|
||||||
ME=$(basename $0)
|
ME=$(basename $0)
|
||||||
echo "usage: $ME"
|
echo "usage: $ME [ <shorewallrc file> ]"
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,35 +69,33 @@ remove_file() # $1 = file to restore
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -f ./.shorewallrc ]; then
|
#
|
||||||
. ./.shorewallrc || exit 1
|
# Read the RC file
|
||||||
|
#
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
if [ -f ./shorewallrc ]; then
|
||||||
|
. ./shorewallrc
|
||||||
elif [ -f ~/.shorewallrc ]; then
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
. ~/.shorewallrc || exit 1
|
. ~/.shorewallrc || exit 1
|
||||||
elif [ -r /root/.shorewallrc ]; then
|
file=./.shorewallrc
|
||||||
. /root/.shorewallrc || exit 1
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
elif [ -r /.shorewallrc ]; then
|
. /usr/share/shorewall/shorewallrc
|
||||||
. /root/.shorewallrc || exit 1
|
|
||||||
elif - -f ${SHOREAWLLRC_HOME}/.shorewallrc; then
|
|
||||||
. ${SHOREWALLRC_HOME}/.shorewallrc || exit 1
|
|
||||||
else
|
else
|
||||||
[ -n "${LIBEXEC:=/usr/share}" ]
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
[ -n "${PERLLIB:=/usr/share/shorewall}" ]
|
fi
|
||||||
[ -n "${CONFDIR:=/etc}" ]
|
elif [ $# -eq 1 ]; then
|
||||||
|
file=$1
|
||||||
|
case $file in
|
||||||
|
/*|.*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
file=./$file
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ -z "$SYSCONFDIR" ]; then
|
. $file
|
||||||
if [ -d /etc/default ]; then
|
|
||||||
SYSCONFDIR=/etc/default
|
|
||||||
else
|
else
|
||||||
SYSCONFDIR=/etc/sysconfig
|
usage 1
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -n "${SBINDIR:=/sbin}" ]
|
|
||||||
[ -n "${SHAREDIR:=/usr/share}" ]
|
|
||||||
[ -n "${VARDIR:=/var/lib}" ]
|
|
||||||
[ -n "${INITFILE:=shorewall}" ]
|
|
||||||
[ -n "${INITDIR:=/etc/init.d}" ]
|
|
||||||
[ -n "${MANDIR:=/usr/share/man}" ]
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f ${SHAREDIR}/shorewall6-lite/version ]; then
|
if [ -f ${SHAREDIR}/shorewall6-lite/version ]; then
|
||||||
|
@ -31,7 +31,7 @@ VERSION=xxx #The Build script inserts the actual version
|
|||||||
usage() # $1 = exit status
|
usage() # $1 = exit status
|
||||||
{
|
{
|
||||||
ME=$(basename $0)
|
ME=$(basename $0)
|
||||||
echo "usage: $ME"
|
echo "usage: $ME [ <shorewallrc file> ]"
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,35 +69,33 @@ remove_file() # $1 = file to restore
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -f ./.shorewallrc ]; then
|
#
|
||||||
. ./.shorewallrc || exit 1
|
# Read the RC file
|
||||||
|
#
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
if [ -f ./shorewallrc ]; then
|
||||||
|
. ./shorewallrc
|
||||||
elif [ -f ~/.shorewallrc ]; then
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
. ~/.shorewallrc || exit 1
|
. ~/.shorewallrc || exit 1
|
||||||
elif [ -r /root/.shorewallrc ]; then
|
file=./.shorewallrc
|
||||||
. /root/.shorewallrc || exit 1
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
elif [ -r /.shorewallrc ]; then
|
. /usr/share/shorewall/shorewallrc
|
||||||
. /root/.shorewallrc || exit 1
|
|
||||||
elif - -f ${SHOREAWLLRC_HOME}/.shorewallrc; then
|
|
||||||
. ${SHOREWALLRC_HOME}/.shorewallrc || exit 1
|
|
||||||
else
|
else
|
||||||
[ -n "${LIBEXEC:=/usr/share}" ]
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
[ -n "${PERLLIB:=/usr/share/shorewall}" ]
|
fi
|
||||||
[ -n "${CONFDIR:=/etc}" ]
|
elif [ $# -eq 1 ]; then
|
||||||
|
file=$1
|
||||||
|
case $file in
|
||||||
|
/*|.*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
file=./$file
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ -z "$SYSCONFDIR" ]; then
|
. $file
|
||||||
if [ -d /etc/default ]; then
|
|
||||||
SYSCONFDIR=/etc/default
|
|
||||||
else
|
else
|
||||||
SYSCONFDIR=/etc/sysconfig
|
usage 1
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -n "${SBINDIR:=/sbin}" ]
|
|
||||||
[ -n "${SHAREDIR:=/usr/share}" ]
|
|
||||||
[ -n "${VARDIR:=/var/lib}" ]
|
|
||||||
[ -n "${INITFILE:=shorewall}" ]
|
|
||||||
[ -n "${INITDIR:=/etc/init.d}" ]
|
|
||||||
[ -n "${MANDIR:=/usr/share/man}" ]
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f ${SHARDIR}/shorewall6/version ]; then
|
if [ -f ${SHARDIR}/shorewall6/version ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user