2002-05-01 01:13:15 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Script to back uninstall Shoreline Firewall
|
|
|
|
#
|
2003-02-23 15:10:37 +01:00
|
|
|
# This program is under GPL [http://www.gnu.org/copyleft/gpl.htm]
|
2002-05-01 01:13:15 +02:00
|
|
|
#
|
2003-01-31 19:04:57 +01:00
|
|
|
# (c) 2000,2001,2002,2003 - Tom Eastep (teastep@shorewall.net)
|
2002-05-01 01:13:15 +02:00
|
|
|
#
|
|
|
|
# Shorewall documentation is available at http://shorewall.sourceforge.net
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
2003-02-23 15:10:37 +01:00
|
|
|
# it under the terms of Version 2 of the GNU General Public License
|
2002-05-01 01:13:15 +02:00
|
|
|
# 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
|
|
|
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
#
|
|
|
|
# You may only use this script to uninstall the version
|
|
|
|
# shown below. Simply run this script to remove Seattle Firewall
|
|
|
|
|
2003-07-15 00:09:33 +02:00
|
|
|
VERSION=1.4.6RC1
|
2002-05-01 01:13:15 +02:00
|
|
|
|
|
|
|
usage() # $1 = exit status
|
|
|
|
{
|
|
|
|
ME=`basename $0`
|
|
|
|
echo "usage: $ME"
|
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
2003-02-23 15:10:37 +01:00
|
|
|
qt()
|
|
|
|
{
|
2002-06-15 19:27:41 +02:00
|
|
|
"$@" >/dev/null 2>&1
|
|
|
|
}
|
|
|
|
|
2002-05-01 01:13:15 +02:00
|
|
|
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
|
2003-02-23 15:10:37 +01:00
|
|
|
fi
|
2002-05-01 01:13:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
remove_file() # $1 = file to restore
|
|
|
|
{
|
|
|
|
if [ -f $1 -o -L $1 ] ; then
|
|
|
|
rm -f $1
|
|
|
|
echo "$1 Removed"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2002-10-15 18:43:34 +02:00
|
|
|
if [ -f /usr/lib/shorewall/version ]; then
|
|
|
|
INSTALLED_VERSION="`cat /usr/lib/shorewall/version`"
|
2002-05-01 01:13:15 +02:00
|
|
|
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
|
2002-06-15 19:27:41 +02:00
|
|
|
echo "WARNING: Shorewall Version $INSTALLED_VERSION is installed"
|
2002-05-01 01:13:15 +02:00
|
|
|
echo " and this is the $VERSION uninstaller."
|
|
|
|
VERSION="$INSTALLED_VERSION"
|
|
|
|
fi
|
|
|
|
else
|
2002-06-15 19:27:41 +02:00
|
|
|
echo "WARNING: Shorewall Version $VERSION is not installed"
|
2002-05-01 01:13:15 +02:00
|
|
|
VERSION=""
|
|
|
|
fi
|
|
|
|
|
2002-06-15 19:27:41 +02:00
|
|
|
echo "Uninstalling Shorewall $VERSION"
|
|
|
|
|
|
|
|
if qt iptables -L shorewall -n; then
|
|
|
|
/sbin/shorewall clear
|
|
|
|
fi
|
2002-05-01 01:13:15 +02:00
|
|
|
|
2002-09-27 23:10:21 +02:00
|
|
|
if [ -L /usr/lib/shorewall/firewall ]; then
|
|
|
|
FIREWALL=`ls -l /usr/lib/shorewall/firewall | sed 's/^.*> //'`
|
|
|
|
elif [ -L /var/lib/shorewall/firewall ]; then
|
2002-06-15 19:27:41 +02:00
|
|
|
FIREWALL=`ls -l /var/lib/shorewall/firewall | sed 's/^.*> //'`
|
2002-10-15 17:51:01 +02:00
|
|
|
elif [ -L /usr/lib/shorewall/init ]; then
|
|
|
|
FIREWALL=`ls -l /usr/lib/shorewall/init | sed 's/^.*> //'`
|
2002-09-27 23:10:21 +02:00
|
|
|
else
|
|
|
|
FIREWALL=
|
|
|
|
fi
|
2002-05-01 01:13:15 +02:00
|
|
|
|
2002-09-27 23:10:21 +02:00
|
|
|
if [ -n "$FIREWALL" ]; then
|
2002-05-01 01:13:15 +02:00
|
|
|
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`
|
|
|
|
fi
|
|
|
|
|
|
|
|
remove_file $FIREWALL
|
2002-10-15 18:51:09 +02:00
|
|
|
rm -f ${FIREWALL}-*.bkout
|
2002-05-01 01:13:15 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
remove_file /sbin/shorewall
|
|
|
|
|
|
|
|
if [ -n "$VERSION" ]; then
|
|
|
|
restore_file /etc/rc.d/rc.local
|
|
|
|
fi
|
|
|
|
|
2002-06-15 19:27:41 +02:00
|
|
|
rm -rf /etc/shorewall
|
2002-09-27 23:10:21 +02:00
|
|
|
rm -rf /usr/lib/shorewall
|
2002-06-15 19:27:41 +02:00
|
|
|
rm -rf /var/lib/shorewall
|
2003-02-08 21:58:44 +01:00
|
|
|
rm -rf /usr/share/shorewall
|
2002-05-01 01:13:15 +02:00
|
|
|
|
2002-06-15 19:27:41 +02:00
|
|
|
echo "Shorewall Uninstalled"
|
2002-05-01 01:13:15 +02:00
|
|
|
|
|
|
|
|