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
|
|
|
#
|
2005-07-09 07:45:05 +02:00
|
|
|
# (c) 2000,2001,2002,2003,2004,2005 - Tom Eastep (teastep@shorewall.net)
|
2002-05-01 01:13:15 +02:00
|
|
|
#
|
2006-11-11 18:21:04 +01:00
|
|
|
# Shorewall documentation is available at http://www.shorewall.net
|
2002-05-01 01:13:15 +02:00
|
|
|
#
|
|
|
|
# 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
|
2005-07-26 01:08:09 +02:00
|
|
|
# shown below. Simply run this script to remove Shorewall Firewall
|
2002-05-01 01:13:15 +02:00
|
|
|
|
2007-02-17 00:00:20 +01:00
|
|
|
VERSION=3.4.0
|
2002-05-01 01:13:15 +02:00
|
|
|
|
|
|
|
usage() # $1 = exit status
|
|
|
|
{
|
2005-07-09 06:45:32 +02:00
|
|
|
ME=$(basename $0)
|
2002-05-01 01:13:15 +02:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2004-01-13 21:54:58 +01:00
|
|
|
if [ -f /usr/share/shorewall/version ]; then
|
2005-07-09 06:45:32 +02:00
|
|
|
INSTALLED_VERSION="$(cat /usr/share/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
|
|
|
|
|
2005-07-09 06:45:32 +02:00
|
|
|
echo "Uninstalling shorewall $VERSION"
|
2002-06-15 19:27:41 +02:00
|
|
|
|
|
|
|
if qt iptables -L shorewall -n; then
|
|
|
|
/sbin/shorewall clear
|
|
|
|
fi
|
2002-05-01 01:13:15 +02:00
|
|
|
|
2005-07-09 06:45:32 +02:00
|
|
|
if [ -L /usr/share/shorewall/init ]; then
|
|
|
|
FIREWALL=$(ls -l /usr/share/shorewall/init | sed 's/^.*> //')
|
2002-09-27 23:10:21 +02:00
|
|
|
else
|
2005-07-09 06:45:32 +02:00
|
|
|
FIREWALL=/etc/init.d/shorewall
|
2002-09-27 23:10:21 +02:00
|
|
|
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
|
2005-07-09 06:45:32 +02:00
|
|
|
chkconfig --del $(basename $FIREWALL)
|
|
|
|
else
|
|
|
|
rm -f /etc/rc*.d/*$(basename $FIREWALL)
|
2002-05-01 01:13:15 +02:00
|
|
|
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
|
|
|
|
|
2003-08-22 17:27:08 +02:00
|
|
|
rm -f /sbin/shorewall
|
|
|
|
rm -f /sbin/shorewall-*.bkout
|
2002-05-01 01:13:15 +02:00
|
|
|
|
2002-06-15 19:27:41 +02:00
|
|
|
rm -rf /etc/shorewall
|
2005-09-13 19:13:35 +02:00
|
|
|
rm -rf /etc/shorewall-*.bkout
|
2002-06-15 19:27:41 +02:00
|
|
|
rm -rf /var/lib/shorewall
|
2005-09-13 19:13:35 +02:00
|
|
|
rm -rf /var/lib/shorewall-*.bkout
|
2003-02-08 21:58:44 +01:00
|
|
|
rm -rf /usr/share/shorewall
|
2005-09-13 19:13:35 +02:00
|
|
|
rm -rf /usr/share/shorewall-*.bkout
|
2006-11-19 02:26:33 +01:00
|
|
|
rm -rf /usr/share/man/man5/shorewall*
|
|
|
|
rm -rf /usr/share/man/man8/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
|
|
|
|
|
|
|
|