2006-06-03 17:16:21 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Script to back uninstall Shoreline Firewall
|
|
|
|
#
|
2007-09-08 18:09:51 +02:00
|
|
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
2007-01-12 23:54:42 +01:00
|
|
|
# (c) 2000,2001,2002,2003,2004,2005,2006,2007 - Tom Eastep (teastep@shorewall.net)
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
|
|
|
# Shorewall documentation is available at http://shorewall.sourceforge.net
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of Version 2 of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
2007-09-08 18:09:51 +02:00
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
#
|
|
|
|
# You may only use this script to uninstall the version
|
|
|
|
# shown below. Simply run this script to remove Shorewall Firewall
|
|
|
|
|
2009-05-10 16:08:47 +02:00
|
|
|
VERSION=4.3.11
|
2006-06-03 17:16:21 +02:00
|
|
|
|
|
|
|
usage() # $1 = exit status
|
|
|
|
{
|
|
|
|
ME=$(basename $0)
|
|
|
|
echo "usage: $ME"
|
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
|
|
|
qt()
|
|
|
|
{
|
|
|
|
"$@" >/dev/null 2>&1
|
|
|
|
}
|
|
|
|
|
|
|
|
restore_file() # $1 = file to restore
|
|
|
|
{
|
|
|
|
if [ -f ${1}-shorewall.bkout ]; then
|
2007-07-21 16:03:37 +02:00
|
|
|
if (mv -f ${1}-shorewall-lite.bkout $1); then
|
2006-06-03 17:16:21 +02:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2006-06-09 18:59:14 +02:00
|
|
|
if [ -f /usr/share/shorewall-lite/version ]; then
|
|
|
|
INSTALLED_VERSION="$(cat /usr/share/shorewall-lite/version)"
|
2006-06-03 17:16:21 +02:00
|
|
|
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
|
2007-07-21 16:03:37 +02:00
|
|
|
echo "WARNING: Shorewall Lite Version $INSTALLED_VERSION is installed"
|
2006-06-03 17:16:21 +02:00
|
|
|
echo " and this is the $VERSION uninstaller."
|
|
|
|
VERSION="$INSTALLED_VERSION"
|
|
|
|
fi
|
|
|
|
else
|
2007-07-21 16:03:37 +02:00
|
|
|
echo "WARNING: Shorewall Lite Version $VERSION is not installed"
|
2006-06-03 17:16:21 +02:00
|
|
|
VERSION=""
|
|
|
|
fi
|
|
|
|
|
2007-07-21 16:03:37 +02:00
|
|
|
echo "Uninstalling Shorewall Lite $VERSION"
|
2006-06-03 17:16:21 +02:00
|
|
|
|
2007-07-21 16:03:37 +02:00
|
|
|
if qt iptables -L shorewall -n && [ ! -f /sbin/shorewall ]; then
|
|
|
|
/sbin/shorewall-lite clear
|
2006-06-03 17:16:21 +02:00
|
|
|
fi
|
|
|
|
|
2006-06-09 18:59:14 +02:00
|
|
|
if [ -L /usr/share/shorewall-lite/init ]; then
|
|
|
|
FIREWALL=$(ls -l /usr/share/shorewall-lite/init | sed 's/^.*> //')
|
2006-06-03 17:16:21 +02:00
|
|
|
else
|
2007-07-21 16:03:37 +02:00
|
|
|
FIREWALL=/etc/init.d/shorewall-lite
|
2006-06-03 17:16:21 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$FIREWALL" ]; then
|
|
|
|
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
|
|
|
|
insserv -r $FIREWALL
|
|
|
|
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
|
|
|
|
chkconfig --del $(basename $FIREWALL)
|
|
|
|
else
|
|
|
|
rm -f /etc/rc*.d/*$(basename $FIREWALL)
|
|
|
|
fi
|
|
|
|
|
|
|
|
remove_file $FIREWALL
|
|
|
|
rm -f ${FIREWALL}-*.bkout
|
|
|
|
fi
|
|
|
|
|
2007-07-21 16:03:37 +02:00
|
|
|
rm -f /sbin/shorewall-lite
|
|
|
|
rm -f /sbin/shorewall-lite-*.bkout
|
2006-06-03 17:16:21 +02:00
|
|
|
|
2006-06-09 18:59:14 +02:00
|
|
|
rm -rf /etc/shorewall-lite
|
|
|
|
rm -rf /etc/shorewall-lite-*.bkout
|
|
|
|
rm -rf /var/lib/shorewall-lite
|
|
|
|
rm -rf /var/lib/shorewall-lite-*.bkout
|
|
|
|
rm -rf /usr/share/shorewall-lite
|
|
|
|
rm -rf /usr/share/shorewall-lite-*.bkout
|
2006-06-03 17:16:21 +02:00
|
|
|
|
|
|
|
echo "Shorewall Uninstalled"
|
|
|
|
|
|
|
|
|