Installer and Uninstaller

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@1107 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2004-01-31 18:06:14 +00:00
parent 517d4dbf46
commit b7d1de7a4e
3 changed files with 261 additions and 327 deletions

View File

@ -49,112 +49,92 @@ restore_file() # $1 = file to restore
fi fi
} }
if [ ! -f /usr/share/shorewall/version-${VERSION}.bkout ]; then if [ ! -f /usr/share/shorewall2/version-${VERSION}.bkout ]; then
echo "Shorewall Version $VERSION is not installed" echo "Shorewall Version $VERSION is not installed"
exit 1 exit 1
fi fi
echo "Backing Out Installation of Shorewall $VERSION" echo "Backing Out Installation of Shorewall $VERSION"
if [ -L /usr/share/shorewall/init ]; then if [ -L /usr/share/shorewall2/init ]; then
FIREWALL=`ls -l /usr/share/shorewall/firewall | sed 's/^.*> //'` FIREWALL=`ls -l /usr/share/shorewall2/firewall | sed 's/^.*> //'`
restore_file $FIREWALL restore_file $FIREWALL
restore_file /usr/share/shorewall/firewall
elif [ -L /usr/lib/shorewall/firewall ]; then
FIREWALL=`ls -l /usr/lib/shorewall/firewall | sed 's/^.*> //'`
restore_file $FIREWALL
elif [ -L /var/lib/shorewall/firewall ]; then
FIREWALL=`ls -l /var/lib/shorewall/firewall | sed 's/^.*> //'`
restore_file $FIREWALL
elif [ -L /usr/lib/shorewall/init ]; then
FIREWALL=`ls -l /usr/lib/shorewall/init | sed 's/^.*> //'`
restore_file $FIREWALL
restore_file /usr/lib/shorewall/firewall
fi
restore_file /sbin/shorewall
[ -f /etc/shorewall.conf.$VERSION ] && rm -f /etc/shorewall.conf.$VERSION
restore_file /etc/shorewall/shorewall.conf
restore_file /etc/shorewall/functions
restore_file /usr/lib/shorewall/functions
restore_file /var/lib/shorewall/functions
restore_file /usr/lib/shorewall/firewall
restore_file /usr/lib/shorewall/help
restore_file /etc/shorewall/common.def
restore_file /etc/shorewall/icmp.def
restore_file /etc/shorewall/zones
restore_file /etc/shorewall/policy
restore_file /etc/shorewall/interfaces
restore_file /etc/shorewall/hosts
restore_file /etc/shorewall/rules
restore_file /etc/shorewall/nat
restore_file /etc/shorewall/params
restore_file /etc/shorewall/proxyarp
restore_file /etc/shorewall/routestopped
restore_file /etc/shorewall/maclist
restore_file /etc/shorewall/masq
restore_file /etc/shorewall/modules
restore_file /etc/shorewall/tcrules
restore_file /etc/shorewall/tos
restore_file /etc/shorewall/tunnels
restore_file /etc/shorewall/blacklist
restore_file /etc/shorewall/whitelist
restore_file /etc/shorewall/rfc1918
restore_file /etc/shorewall/init
restore_file /etc/shorewall/start
restore_file /etc/shorewall/stop
restore_file /etc/shorewall/stopped
restore_file /etc/shorewall/ecn
restore_file /etc/shorewall/accounting
restore_file /etc/shorewall/usersets
restore_file /etc/shorewall/users
restore_file /etc/shorewall/actions
restore_file /etc/shorewall/action.template
if [ -f /usr/lib/shorewall/version-${VERSION}.bkout ]; then
restore_file /usr/lib/shorewall/version
oldversion="`cat /usr/lib/shorewall/version`"
elif [ -f /var/lib/shorewall/version-${VERSION}.bkout ]; then
restore_file /var/lib/shorewall/version
oldversion="`cat /var/lib/shorewall/version`"
else else
restore_file /etc/shorewall/version restore_file /etc/init.d/shorewall2
oldversion="`cat /etc/shorewall/version`"
fi fi
echo "Shorewall Restored to Version $oldversion" restore_file /usr/share/shorewall2/firewall
restore_file /sbin/shorewall2
restore_file /etc/shorewall2/shorewall.conf
restore_file /etc/shorewall2/functions
restore_file /usr/lib/shorewall2/functions
restore_file /var/lib/shorewall2/functions
restore_file /usr/lib/shorewall2/firewall
restore_file /usr/lib/shorewall2/help
restore_file /etc/shorewall2/common.def
restore_file /etc/shorewall2/icmp.def
restore_file /etc/shorewall2/zones
restore_file /etc/shorewall2/policy
restore_file /etc/shorewall2/interfaces
restore_file /etc/shorewall2/hosts
restore_file /etc/shorewall2/rules
restore_file /etc/shorewall2/nat
restore_file /etc/shorewall2/params
restore_file /etc/shorewall2/proxyarp
restore_file /etc/shorewall2/routestopped
restore_file /etc/shorewall2/maclist
restore_file /etc/shorewall2/masq
restore_file /etc/shorewall2/modules
restore_file /etc/shorewall2/tcrules
restore_file /etc/shorewall2/tos
restore_file /etc/shorewall2/tunnels
restore_file /etc/shorewall2/blacklist
restore_file /etc/shorewall2/whitelist
restore_file /etc/shorewall2/rfc1918
restore_file /etc/shorewall2/init
restore_file /etc/shorewall2/start
restore_file /etc/shorewall2/stop
restore_file /etc/shorewall2/stopped
restore_file /etc/shorewall2/ecn
restore_file /etc/shorewall2/accounting
restore_file /etc/shorewall2/actions
for f in /etc/shorewall2/action.*-${VERSION}.bkout; do
restore_file $(echo $f | sed "s/-${VERSION}.bkout//")
done
restore_file /usr/share/shorewall2/version
echo "Shorewall2 Restored to Version $oldversion"

View File

@ -77,7 +77,7 @@ run_install()
cant_autostart() cant_autostart()
{ {
echo echo
echo "WARNING: Unable to configure Shorewall to start" echo "WARNING: Unable to configure Shorewall2 to start"
echo " automatically at boot" echo " automatically at boot"
} }
@ -105,20 +105,6 @@ delete_file() # $1 = file to delete
fi fi
} }
modify_rclocal()
{
if [ -f /etc/rc.d/rc.local ]; then
if [ -z "`grep shorewall /etc/rc.d/rc.local`" ]; then
cp -f /etc/rc.d/rc.local /etc/rc.d/rc.local-shorewall.bkout
echo >> /etc/rc.d/rc.local
echo "/sbin/shorewall start" >> /etc/rc.d/rc.local
echo "/etc/rc.d/rc.local modified to start Shorewall"
fi
else
cant_autostart
fi
}
install_file_with_backup() # $1 = source $2 = target $3 = mode install_file_with_backup() # $1 = source $2 = target $3 = mode
{ {
backup_file $2 backup_file $2
@ -195,7 +181,7 @@ if [ -n "$PREFIX" ]; then
install -d -o $OWNER -g $GROUP -m 755 ${PREFIX}${DEST} install -d -o $OWNER -g $GROUP -m 755 ${PREFIX}${DEST}
fi fi
FIREWALL="shorewall" FIREWALL="shorewall2"
# #
# Change to the directory containing this script # Change to the directory containing this script
@ -205,18 +191,18 @@ cd "`dirname $0`"
echo "Installing Shorewall Version $VERSION" echo "Installing Shorewall Version $VERSION"
# #
# Check for /etc/shorewall # Check for /etc/shorewall2
# #
if [ -d ${PREFIX}/etc/shorewall ]; then if [ -d ${PREFIX}/etc/shorewall2 ]; then
first_install="" first_install=""
else else
first_install="Yes" first_install="Yes"
fi fi
install_file_with_backup shorewall ${PREFIX}/sbin/shorewall 0544 install_file_with_backup shorewall ${PREFIX}/sbin/shorewall2 0544
echo echo
echo "Shorewall control program installed in ${PREFIX}/sbin/shorewall" echo "Shorewall2 control program installed in ${PREFIX}/sbin/shorewall2"
# #
# Install the Firewall Script # Install the Firewall Script
@ -227,64 +213,59 @@ echo
echo "Shorewall script installed in ${PREFIX}${DEST}/$FIREWALL" echo "Shorewall script installed in ${PREFIX}${DEST}/$FIREWALL"
# #
# Create /etc/shorewall, /usr/share/shorewall and /var/shorewall if needed # Create /etc/shorewall2, /usr/share/shorewall2 and /var/shorewall if needed
# #
mkdir -p ${PREFIX}/etc/shorewall mkdir -p ${PREFIX}/etc/shorewall2
mkdir -p ${PREFIX}/usr/share/shorewall mkdir -p ${PREFIX}/usr/share/shorewall2
mkdir -p ${PREFIX}/var/lib/shorewall mkdir -p ${PREFIX}/var/lib/shorewall
# #
# Install the config file # Install the config file
# #
if [ -f ${PREFIX}/etc/shorewall/shorewall.conf ]; then if [ -f ${PREFIX}/etc/shorewall2/shorewall.conf ]; then
backup_file /etc/shorewall/shorewall.conf backup_file /etc/shorewall2/shorewall.conf
else else
run_install -o $OWNER -g $GROUP -m 0744 shorewall.conf ${PREFIX}/etc/shorewall/shorewall.conf run_install -o $OWNER -g $GROUP -m 0744 shorewall.conf ${PREFIX}/etc/shorewall2/shorewall.conf
echo echo
echo "Config file installed as ${PREFIX}/etc/shorewall/shorewall.conf" echo "Config file installed as ${PREFIX}/etc/shorewall2/shorewall.conf"
fi fi
# #
# Install the zones file # Install the zones file
# #
if [ -f ${PREFIX}/etc/shorewall/zones ]; then if [ -f ${PREFIX}/etc/shorewall2/zones ]; then
backup_file /etc/shorewall/zones backup_file /etc/shorewall2/zones
else else
run_install -o $OWNER -g $GROUP -m 0744 zones ${PREFIX}/etc/shorewall/zones run_install -o $OWNER -g $GROUP -m 0744 zones ${PREFIX}/etc/shorewall2/zones
echo echo
echo "Zones file installed as ${PREFIX}/etc/shorewall/zones" echo "Zones file installed as ${PREFIX}/etc/shorewall2/zones"
fi fi
# #
# Install the functions file # Install the functions file
# #
if [ -f ${PREFIX}/etc/shorewall/functions ]; then if [ -f ${PREFIX}/etc/shorewall2/functions ]; then
backup_file ${PREFIX}/etc/shorewall/functions backup_file ${PREFIX}/etc/shorewall2/functions
rm -f ${PREFIX}/etc/shorewall/functions rm -f ${PREFIX}/etc/shorewall2/functions
fi fi
if [ -f ${PREFIX}/var/lib/shorewall/functions ]; then install_file_with_backup functions ${PREFIX}/usr/share/shorewall2/functions 0444
backup_file ${PREFIX}/var/lib/shorewall/functions
rm -f ${PREFIX}/var/lib/shorewall/functions
fi
install_file_with_backup functions ${PREFIX}/usr/share/shorewall/functions 0444
echo echo
echo "Common functions installed in ${PREFIX}/usr/share/shorewall/functions" echo "Common functions installed in ${PREFIX}/usr/share/shorewall2/functions"
# #
# Install the Help file # Install the Help file
# #
install_file_with_backup help ${PREFIX}/usr/share/shorewall/help 0544 install_file_with_backup help ${PREFIX}/usr/share/shorewall2/help 0544
echo echo
echo "Help command executor installed in ${PREFIX}/usr/share/shorewall/help" echo "Help command executor installed in ${PREFIX}/usr/share/shorewall2/help"
# #
# Install the common.def file # Install the common.def file
# #
install_file_with_backup common.def ${PREFIX}/etc/shorewall/common.def 0444 install_file_with_backup common.def ${PREFIX}/etc/shorewall2/common.def 0444
echo echo
echo "Common rules installed in ${PREFIX}/etc/shorewall/common.def" echo "Common rules installed in ${PREFIX}/etc/shorewall2/common.def"
# #
# Delete the icmp.def file # Delete the icmp.def file
@ -294,337 +275,317 @@ delete_file icmp.def
# #
# Install the policy file # Install the policy file
# #
if [ -f ${PREFIX}/etc/shorewall/policy ]; then if [ -f ${PREFIX}/etc/shorewall2/policy ]; then
backup_file /etc/shorewall/policy backup_file /etc/shorewall2/policy
else else
run_install -o $OWNER -g $GROUP -m 0600 policy ${PREFIX}/etc/shorewall/policy run_install -o $OWNER -g $GROUP -m 0600 policy ${PREFIX}/etc/shorewall2/policy
echo echo
echo "Policy file installed as ${PREFIX}/etc/shorewall/policy" echo "Policy file installed as ${PREFIX}/etc/shorewall2/policy"
fi fi
# #
# Install the interfaces file # Install the interfaces file
# #
if [ -f ${PREFIX}/etc/shorewall/interfaces ]; then if [ -f ${PREFIX}/etc/shorewall2/interfaces ]; then
backup_file /etc/shorewall/interfaces backup_file /etc/shorewall2/interfaces
else else
run_install -o $OWNER -g $GROUP -m 0600 interfaces ${PREFIX}/etc/shorewall/interfaces run_install -o $OWNER -g $GROUP -m 0600 interfaces ${PREFIX}/etc/shorewall2/interfaces
echo echo
echo "Interfaces file installed as ${PREFIX}/etc/shorewall/interfaces" echo "Interfaces file installed as ${PREFIX}/etc/shorewall2/interfaces"
fi fi
# #
# Install the hosts file # Install the hosts file
# #
if [ -f ${PREFIX}/etc/shorewall/hosts ]; then if [ -f ${PREFIX}/etc/shorewall2/hosts ]; then
backup_file /etc/shorewall/hosts backup_file /etc/shorewall2/hosts
else else
run_install -o $OWNER -g $GROUP -m 0600 hosts ${PREFIX}/etc/shorewall/hosts run_install -o $OWNER -g $GROUP -m 0600 hosts ${PREFIX}/etc/shorewall2/hosts
echo echo
echo "Hosts file installed as ${PREFIX}/etc/shorewall/hosts" echo "Hosts file installed as ${PREFIX}/etc/shorewall2/hosts"
fi fi
# #
# Install the rules file # Install the rules file
# #
if [ -f ${PREFIX}/etc/shorewall/rules ]; then if [ -f ${PREFIX}/etc/shorewall2/rules ]; then
backup_file /etc/shorewall/rules backup_file /etc/shorewall2/rules
else else
run_install -o $OWNER -g $GROUP -m 0600 rules ${PREFIX}/etc/shorewall/rules run_install -o $OWNER -g $GROUP -m 0600 rules ${PREFIX}/etc/shorewall2/rules
echo echo
echo "Rules file installed as ${PREFIX}/etc/shorewall/rules" echo "Rules file installed as ${PREFIX}/etc/shorewall2/rules"
fi fi
# #
# Install the NAT file # Install the NAT file
# #
if [ -f ${PREFIX}/etc/shorewall/nat ]; then if [ -f ${PREFIX}/etc/shorewall2/nat ]; then
backup_file /etc/shorewall/nat backup_file /etc/shorewall2/nat
else else
run_install -o $OWNER -g $GROUP -m 0600 nat ${PREFIX}/etc/shorewall/nat run_install -o $OWNER -g $GROUP -m 0600 nat ${PREFIX}/etc/shorewall2/nat
echo echo
echo "NAT file installed as ${PREFIX}/etc/shorewall/nat" echo "NAT file installed as ${PREFIX}/etc/shorewall2/nat"
fi fi
# #
# Install the Parameters file # Install the Parameters file
# #
if [ -f ${PREFIX}/etc/shorewall/params ]; then if [ -f ${PREFIX}/etc/shorewall2/params ]; then
backup_file /etc/shorewall/params backup_file /etc/shorewall2/params
else else
run_install -o $OWNER -g $GROUP -m 0600 params ${PREFIX}/etc/shorewall/params run_install -o $OWNER -g $GROUP -m 0600 params ${PREFIX}/etc/shorewall2/params
echo echo
echo "Parameter file installed as ${PREFIX}/etc/shorewall/params" echo "Parameter file installed as ${PREFIX}/etc/shorewall2/params"
fi fi
# #
# Install the proxy ARP file # Install the proxy ARP file
# #
if [ -f ${PREFIX}/etc/shorewall/proxyarp ]; then if [ -f ${PREFIX}/etc/shorewall2/proxyarp ]; then
backup_file /etc/shorewall/proxyarp backup_file /etc/shorewall2/proxyarp
else else
run_install -o $OWNER -g $GROUP -m 0600 proxyarp ${PREFIX}/etc/shorewall/proxyarp run_install -o $OWNER -g $GROUP -m 0600 proxyarp ${PREFIX}/etc/shorewall2/proxyarp
echo echo
echo "Proxy ARP file installed as ${PREFIX}/etc/shorewall/proxyarp" echo "Proxy ARP file installed as ${PREFIX}/etc/shorewall2/proxyarp"
fi fi
# #
# Install the Stopped Routing file # Install the Stopped Routing file
# #
if [ -f ${PREFIX}/etc/shorewall/routestopped ]; then if [ -f ${PREFIX}/etc/shorewall2/routestopped ]; then
backup_file /etc/shorewall/routestopped backup_file /etc/shorewall2/routestopped
else else
run_install -o $OWNER -g $GROUP -m 0600 routestopped ${PREFIX}/etc/shorewall/routestopped run_install -o $OWNER -g $GROUP -m 0600 routestopped ${PREFIX}/etc/shorewall2/routestopped
echo echo
echo "Stopped Routing file installed as ${PREFIX}/etc/shorewall/routestopped" echo "Stopped Routing file installed as ${PREFIX}/etc/shorewall2/routestopped"
fi fi
# #
# Install the Mac List file # Install the Mac List file
# #
if [ -f ${PREFIX}/etc/shorewall/maclist ]; then if [ -f ${PREFIX}/etc/shorewall2/maclist ]; then
backup_file /etc/shorewall/maclist backup_file /etc/shorewall2/maclist
else else
run_install -o $OWNER -g $GROUP -m 0600 maclist ${PREFIX}/etc/shorewall/maclist run_install -o $OWNER -g $GROUP -m 0600 maclist ${PREFIX}/etc/shorewall2/maclist
echo echo
echo "MAC list file installed as ${PREFIX}/etc/shorewall/maclist" echo "MAC list file installed as ${PREFIX}/etc/shorewall2/maclist"
fi fi
# #
# Install the Masq file # Install the Masq file
# #
if [ -f ${PREFIX}/etc/shorewall/masq ]; then if [ -f ${PREFIX}/etc/shorewall2/masq ]; then
backup_file /etc/shorewall/masq backup_file /etc/shorewall2/masq
else else
run_install -o $OWNER -g $GROUP -m 0600 masq ${PREFIX}/etc/shorewall/masq run_install -o $OWNER -g $GROUP -m 0600 masq ${PREFIX}/etc/shorewall2/masq
echo echo
echo "Masquerade file installed as ${PREFIX}/etc/shorewall/masq" echo "Masquerade file installed as ${PREFIX}/etc/shorewall2/masq"
fi fi
# #
# Install the Modules file # Install the Modules file
# #
if [ -f ${PREFIX}/etc/shorewall/modules ]; then if [ -f ${PREFIX}/etc/shorewall2/modules ]; then
backup_file /etc/shorewall/modules backup_file /etc/shorewall2/modules
else else
run_install -o $OWNER -g $GROUP -m 0600 modules ${PREFIX}/etc/shorewall/modules run_install -o $OWNER -g $GROUP -m 0600 modules ${PREFIX}/etc/shorewall2/modules
echo echo
echo "Modules file installed as ${PREFIX}/etc/shorewall/modules" echo "Modules file installed as ${PREFIX}/etc/shorewall2/modules"
fi fi
# #
# Install the TC Rules file # Install the TC Rules file
# #
if [ -f ${PREFIX}/etc/shorewall/tcrules ]; then if [ -f ${PREFIX}/etc/shorewall2/tcrules ]; then
backup_file /etc/shorewall/tcrules backup_file /etc/shorewall2/tcrules
else else
run_install -o $OWNER -g $GROUP -m 0600 tcrules ${PREFIX}/etc/shorewall/tcrules run_install -o $OWNER -g $GROUP -m 0600 tcrules ${PREFIX}/etc/shorewall2/tcrules
echo echo
echo "TC Rules file installed as ${PREFIX}/etc/shorewall/tcrules" echo "TC Rules file installed as ${PREFIX}/etc/shorewall2/tcrules"
fi fi
# #
# Install the TOS file # Install the TOS file
# #
if [ -f ${PREFIX}/etc/shorewall/tos ]; then if [ -f ${PREFIX}/etc/shorewall2/tos ]; then
backup_file /etc/shorewall/tos backup_file /etc/shorewall2/tos
else else
run_install -o $OWNER -g $GROUP -m 0600 tos ${PREFIX}/etc/shorewall/tos run_install -o $OWNER -g $GROUP -m 0600 tos ${PREFIX}/etc/shorewall2/tos
echo echo
echo "TOS file installed as ${PREFIX}/etc/shorewall/tos" echo "TOS file installed as ${PREFIX}/etc/shorewall2/tos"
fi fi
# #
# Install the Tunnels file # Install the Tunnels file
# #
if [ -f ${PREFIX}/etc/shorewall/tunnels ]; then if [ -f ${PREFIX}/etc/shorewall2/tunnels ]; then
backup_file /etc/shorewall/tunnels backup_file /etc/shorewall2/tunnels
else else
run_install -o $OWNER -g $GROUP -m 0600 tunnels ${PREFIX}/etc/shorewall/tunnels run_install -o $OWNER -g $GROUP -m 0600 tunnels ${PREFIX}/etc/shorewall2/tunnels
echo echo
echo "Tunnels file installed as ${PREFIX}/etc/shorewall/tunnels" echo "Tunnels file installed as ${PREFIX}/etc/shorewall2/tunnels"
fi fi
# #
# Install the blacklist file # Install the blacklist file
# #
if [ -f ${PREFIX}/etc/shorewall/blacklist ]; then if [ -f ${PREFIX}/etc/shorewall2/blacklist ]; then
backup_file /etc/shorewall/blacklist backup_file /etc/shorewall2/blacklist
else else
run_install -o $OWNER -g $GROUP -m 0600 blacklist ${PREFIX}/etc/shorewall/blacklist run_install -o $OWNER -g $GROUP -m 0600 blacklist ${PREFIX}/etc/shorewall2/blacklist
echo echo
echo "Blacklist file installed as ${PREFIX}/etc/shorewall/blacklist" echo "Blacklist file installed as ${PREFIX}/etc/shorewall2/blacklist"
fi fi
# #
# Backup and remove the whitelist file # Backup and remove the whitelist file
# #
if [ -f ${PREFIX}/etc/shorewall/whitelist ]; then if [ -f ${PREFIX}/etc/shorewall2/whitelist ]; then
backup_file /etc/shorewall/whitelist backup_file /etc/shorewall2/whitelist
rm -f ${PREFIX}/etc/shorewall/whitelist rm -f ${PREFIX}/etc/shorewall2/whitelist
fi fi
# #
# Install the rfc1918 file # Install the rfc1918 file
# #
if [ -f ${PREFIX}/etc/shorewall/rfc1918 ]; then if [ -f ${PREFIX}/etc/shorewall2/rfc1918 ]; then
backup_file /etc/shorewall/rfc1918 backup_file /etc/shorewall2/rfc1918
else else
run_install -o $OWNER -g $GROUP -m 0600 rfc1918 ${PREFIX}/etc/shorewall/rfc1918 run_install -o $OWNER -g $GROUP -m 0600 rfc1918 ${PREFIX}/etc/shorewall2/rfc1918
echo echo
echo "RFC 1918 file installed as ${PREFIX}/etc/shorewall/rfc1918" echo "RFC 1918 file installed as ${PREFIX}/etc/shorewall2/rfc1918"
fi fi
# #
# Install the init file # Install the init file
# #
if [ -f ${PREFIX}/etc/shorewall/init ]; then if [ -f ${PREFIX}/etc/shorewall2/init ]; then
backup_file /etc/shorewall/init backup_file /etc/shorewall2/init
else else
run_install -o $OWNER -g $GROUP -m 0600 init ${PREFIX}/etc/shorewall/init run_install -o $OWNER -g $GROUP -m 0600 init ${PREFIX}/etc/shorewall2/init
echo echo
echo "Init file installed as ${PREFIX}/etc/shorewall/init" echo "Init file installed as ${PREFIX}/etc/shorewall2/init"
fi fi
# #
# Install the start file # Install the start file
# #
if [ -f ${PREFIX}/etc/shorewall/start ]; then if [ -f ${PREFIX}/etc/shorewall2/start ]; then
backup_file /etc/shorewall/start backup_file /etc/shorewall2/start
else else
run_install -o $OWNER -g $GROUP -m 0600 start ${PREFIX}/etc/shorewall/start run_install -o $OWNER -g $GROUP -m 0600 start ${PREFIX}/etc/shorewall2/start
echo echo
echo "Start file installed as ${PREFIX}/etc/shorewall/start" echo "Start file installed as ${PREFIX}/etc/shorewall2/start"
fi fi
# #
# Install the stop file # Install the stop file
# #
if [ -f ${PREFIX}/etc/shorewall/stop ]; then if [ -f ${PREFIX}/etc/shorewall2/stop ]; then
backup_file /etc/shorewall/stop backup_file /etc/shorewall2/stop
else else
run_install -o $OWNER -g $GROUP -m 0600 stop ${PREFIX}/etc/shorewall/stop run_install -o $OWNER -g $GROUP -m 0600 stop ${PREFIX}/etc/shorewall2/stop
echo echo
echo "Stop file installed as ${PREFIX}/etc/shorewall/stop" echo "Stop file installed as ${PREFIX}/etc/shorewall2/stop"
fi fi
# #
# Install the stopped file # Install the stopped file
# #
if [ -f ${PREFIX}/etc/shorewall/stopped ]; then if [ -f ${PREFIX}/etc/shorewall2/stopped ]; then
backup_file /etc/shorewall/stopped backup_file /etc/shorewall2/stopped
else else
run_install -o $OWNER -g $GROUP -m 0600 stopped ${PREFIX}/etc/shorewall/stopped run_install -o $OWNER -g $GROUP -m 0600 stopped ${PREFIX}/etc/shorewall2/stopped
echo echo
echo "Stopped file installed as ${PREFIX}/etc/shorewall/stopped" echo "Stopped file installed as ${PREFIX}/etc/shorewall2/stopped"
fi fi
# #
# Install the ECN file # Install the ECN file
# #
if [ -f ${PREFIX}/etc/shorewall/ecn ]; then if [ -f ${PREFIX}/etc/shorewall2/ecn ]; then
backup_file /etc/shorewall/ecn backup_file /etc/shorewall2/ecn
else else
run_install -o $OWNER -g $GROUP -m 0600 ecn ${PREFIX}/etc/shorewall/ecn run_install -o $OWNER -g $GROUP -m 0600 ecn ${PREFIX}/etc/shorewall2/ecn
echo echo
echo "ECN file installed as ${PREFIX}/etc/shorewall/ecn" echo "ECN file installed as ${PREFIX}/etc/shorewall2/ecn"
fi fi
# #
# Install the Accounting file # Install the Accounting file
# #
if [ -f ${PREFIX}/etc/shorewall/accounting ]; then if [ -f ${PREFIX}/etc/shorewall2/accounting ]; then
backup_file /etc/shorewall/accounting backup_file /etc/shorewall2/accounting
else else
run_install -o $OWNER -g $GROUP -m 0600 accounting ${PREFIX}/etc/shorewall/accounting run_install -o $OWNER -g $GROUP -m 0600 accounting ${PREFIX}/etc/shorewall2/accounting
echo echo
echo "Accounting file installed as ${PREFIX}/etc/shorewall/accounting" echo "Accounting file installed as ${PREFIX}/etc/shorewall2/accounting"
fi fi
# #
# Install the User Sets file
#
if [ -f ${PREFIX}/etc/shorewall/usersets ]; then
backup_file /etc/shorewall/usersets
else
run_install -o $OWNER -g $GROUP -m 0600 usersets ${PREFIX}/etc/shorewall/usersets
echo
echo "User Sets file installed as ${PREFIX}/etc/shorewall/usersets"
fi
#
# Install the User file
#
if [ -f ${PREFIX}/etc/shorewall/users ]; then
backup_file /etc/shorewall/users
else
run_install -o $OWNER -g $GROUP -m 0600 users ${PREFIX}/etc/shorewall/users
echo
echo "Users file installed as ${PREFIX}/etc/shorewall/users"
fi
# #
# Install the Actions file # Install the Actions file
# #
if [ -f ${PREFIX}/etc/shorewall/actions ]; then if [ -f ${PREFIX}/etc/shorewall2/actions ]; then
backup_file /etc/shorewall/actions backup_file /etc/shorewall2/actions
else else
run_install -o $OWNER -g $GROUP -m 0600 actions ${PREFIX}/etc/shorewall/actions run_install -o $OWNER -g $GROUP -m 0600 actions ${PREFIX}/etc/shorewall2/actions
echo echo
echo "Actions file installed as ${PREFIX}/etc/shorewall/actions" echo "Actions file installed as ${PREFIX}/etc/shorewall2/actions"
fi fi
# #
# Install the Action Template file # Install the Action files
# #
if [ -f ${PREFIX}/etc/shorewall/action.template ]; then for f in action.* ; do
backup_file /etc/shorewall/action.template if [ -f ${PREFIX}/etc/shorewall2/$f ]; then
else backup_file /etc/shorewall2/$f
run_install -o $OWNER -g $GROUP -m 0600 action.template ${PREFIX}/etc/shorewall/action.template else
echo run_install -o $OWNER -g $GROUP -m 0600 $f ${PREFIX}/etc/shorewall2/$f
echo "Action Template file installed as ${PREFIX}/etc/shorewall/action.template" echo
fi echo "Action ${f#*.} file installed as ${PREFIX}/etc/shorewall2/$f"
fi
done
# #
# Backup the version file # Backup the version file
# #
if [ -z "$PREFIX" ]; then if [ -z "$PREFIX" ]; then
if [ -f /usr/share/shorewall/version ]; then if [ -f /usr/share/shorewall2/version ]; then
backup_file /usr/share/shorewall/version backup_file /usr/share/shorewall2/version
elif [ -f /usr/lib/shorewall/version ]; then
backup_file /usr/lib/shorewall/version
elif [ -n "$oldversion" ]; then
echo $oldversion > /usr/lib/shorewall/version-${VERSION}.bkout
else
echo "Unknown" > /usr/lib/shorewall/version-${VERSION}.bkout
fi fi
fi fi
# #
# Create the version file # Create the version file
# #
echo "$VERSION" > ${PREFIX}/usr/share/shorewall/version echo "$VERSION" > ${PREFIX}/usr/share/shorewall2/version
chmod 644 ${PREFIX}/usr/share/shorewall/version chmod 644 ${PREFIX}/usr/share/shorewall2/version
# #
# Remove and create the symbolic link to the init script # Remove and create the symbolic link to the init script
# #
if [ -z "$PREFIX" ]; then if [ -z "$PREFIX" ]; then
rm -f /usr/share/shorewall/init rm -f /usr/share/shorewall2/init
ln -s ${DEST}/${FIREWALL} /usr/share/shorewall/init ln -s ${DEST}/${FIREWALL} /usr/share/shorewall2/init
fi fi
# #
# Install the firewall script # Install the firewall script
# #
install_file_with_backup firewall ${PREFIX}/usr/share/shorewall/firewall 0544 install_file_with_backup firewall ${PREFIX}/usr/share/shorewall2/firewall 0544
if [ -z "$PREFIX" -a -n "$first_install" ]; then if [ -z "$PREFIX" -a -n "$first_install" ]; then
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if insserv /etc/init.d/shorewall ; then
echo
echo "Firewall will start automatically at boot"
else
cant_autostart
fi
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
if chkconfig --add $FIREWALL ; then
echo
echo "Firewall will start automatically in run levels as follows:"
chkconfig --list $FIREWALL
else
cant_autostart
fi
elif [ -x /sbin/rc-update ]; then
if rc-update add shorewall default; then
echo
echo "Firewall will start automatically at boot"
else
cant_autostart
fi
else
cant_autostart
fi
if [ -n "$DEBIAN" ]; then if [ -n "$DEBIAN" ]; then
run_install -o $OWNER -g $GROUP -m 0644 default.debian /etc/default/shorewall run_install -o $OWNER -g $GROUP -m 0644 default.debian /etc/default/shorewall2
ln -s ../init.d/shorewall2 /etc/rcS.d/S40shorewall2
echo
echo "Shorewall2 will start automatically at boot"
else else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if insserv /etc/init.d/shorewalls ; then
echo
echo "Shorewall2 will start automatically at boot"
else
cant_autostart
fi
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
if chkconfig --add shorewall2 ; then
echo
echo "Shorewall2 will start automatically in run levels as follows:"
chkconfig --list $FIREWALL
else
cant_autostart
fi
elif [ -x /sbin/rc-update ]; then
if rc-update add shorewall2 default; then
echo
echo "Shorewall2 will start automatically at boot"
else
cant_autostart
fi
else
cant_autostart
fi
echo \ echo \
"######################################################################## "########################################################################
# REMOVE THIS FILE AFTER YOU HAVE CONFIGURED SHOREWALL # # REMOVE THIS FILE AFTER YOU HAVE CONFIGURED SHOREWALL #
########################################################################" > /etc/shorewall/startup_disabled ########################################################################" > /etc/shorewall2/startup_disabled
fi fi
fi fi
@ -632,4 +593,4 @@ fi
# Report Success # Report Success
# #
echo echo
echo "Shorewall Version $VERSION Installed" echo "Shorewall2 Version $VERSION Installed"

View File

@ -60,8 +60,8 @@ remove_file() # $1 = file to restore
fi fi
} }
if [ -f /usr/share/shorewall/version ]; then if [ -f /usr/share/shorewall2/version ]; then
INSTALLED_VERSION="`cat /usr/lib/shorewall/version`" INSTALLED_VERSION="`cat /usr/share/shorewall2/version`"
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "WARNING: Shorewall Version $INSTALLED_VERSION is installed" echo "WARNING: Shorewall Version $INSTALLED_VERSION is installed"
echo " and this is the $VERSION uninstaller." echo " and this is the $VERSION uninstaller."
@ -75,17 +75,13 @@ fi
echo "Uninstalling Shorewall2 $VERSION" echo "Uninstalling Shorewall2 $VERSION"
if qt iptables -L shorewall -n; then if qt iptables -L shorewall -n; then
/sbin/shorewall clear /sbin/shorewall2 clear
fi fi
if [ -L /usr/lib/shorewall/firewall ]; then if [ -L /usr/share/shorewall2/init ]; then
FIREWALL=`ls -l /usr/lib/shorewall/firewall | sed 's/^.*> //'` FIREWALL=`ls -l /usr/share/shorewall2/init | sed 's/^.*> //'`
elif [ -L /var/lib/shorewall/firewall ]; then
FIREWALL=`ls -l /var/lib/shorewall/firewall | sed 's/^.*> //'`
elif [ -L /usr/lib/shorewall/init ]; then
FIREWALL=`ls -l /usr/lib/shorewall/init | sed 's/^.*> //'`
else else
FIREWALL= FIREWALL=/etc/init.d/shorewall2
fi fi
if [ -n "$FIREWALL" ]; then if [ -n "$FIREWALL" ]; then
@ -93,24 +89,21 @@ if [ -n "$FIREWALL" ]; then
insserv -r $FIREWALL insserv -r $FIREWALL
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
chkconfig --del `basename $FIREWALL` chkconfig --del `basename $FIREWALL`
else
rm -f /etc/rc*.d/*`basename $FIREWALL`
fi fi
remove_file $FIREWALL remove_file $FIREWALL
rm -f ${FIREWALL}-*.bkout rm -f ${FIREWALL}-*.bkout
fi fi
rm -f /sbin/shorewall rm -f /sbin/shorewall2
rm -f /sbin/shorewall-*.bkout rm -f /sbin/shorewall2-*.bkout
if [ -n "$VERSION" ]; then rm -rf /etc/shorewall2
restore_file /etc/rc.d/rc.local rm -rf /var/lib/shorewall2
fi rm -rf /usr/share/shorewall2
rm -rf /etc/shorewall echo "Shorewall2 Uninstalled"
rm -rf /usr/lib/shorewall
rm -rf /var/lib/shorewall
rm -rf /usr/share/shorewall
echo "Shorewall Uninstalled"