shorewall_code/Shorewall/debian/shorewall.postinst

111 lines
2.5 KiB
Plaintext
Raw Normal View History

#!/bin/sh -e
. /usr/share/debconf/confmodule
case "$1" in
configure)
# create the default file to prevent automatic startup for unconfigured
# firewall
if [ ! -f "/etc/default/shorewall" ]
then
cat > /etc/default/shorewall << _EOF_
# prevent startup with default configuration
# set the below varible to 1 in order to allow shorewall to start
startup=0
# if your shorewall's configuration need to detect the ip address of a ppp
# interface you must list such interface in "wait_interface" to get shorewall to
# wait until the interface is configured otherwise the script will fail because
# it won't be able to detect the address.
#
# Example:
# wait_interface="ppp0"
# or
# wait_interface="ppp0 ppp1"
# or, if you have defined $PPP in /etc/shorewall/params
# wait_interface=$PPP
# EOF
_EOF_
fi
# install the default configuration files
# test -f /usr/share/shorewall/configfiles && rm -f /usr/share/shorewall/configfiles
# for i in /usr/share/doc/shorewall/default-config/*
# do
# o=`basename $i`
# p=`echo $o | sed "s/\.gz$//"`
# if [ ! -f /etc/shorewall/$p ]
# then
# if [ `echo $o | grep "\.gz$"` ]
# then
# o=`echo $o | sed "s/\.gz$//"`
# gunzip -c $i > /etc/shorewall/$o
# else
# cp $i /etc/shorewall/$o
# fi
# chmod 600 /etc/shorewall/$p
# fi
# echo "/etc/shorewall/$p" >> /usr/share/shorewall/configfiles
# done
# if we are upgrading from a version older than 1.3.11a-2 we should
# update our init script in order to setup the firewall just after the
# network configuration
if [ "$2" ] && dpkg --compare-versions "$2" le "1.3.11a-1"
then
update-rc.d -f shorewall remove > /dev/null 2>&1
fi
restart="true"
if [ "$2" ] && dpkg --compare-versions "$2" le "1.4.0-1"
then
db_get shorewall/upgrade_to_14 || true
if [ "$RET" = "false" ]
then
restart="false"
fi
else
if [ "$2" ] && dpkg --compare-versions "$2" le "2.0"
then
db_get shorewall/upgrade_14_20 || true
if [ "$RET" = "false" ]
then
restart="false"
fi
else
if [ "$2" ] && dpkg --compare-versions "$2" le "2.1.99"
then
db_get shorewall/upgrade_20_22 || true
if [ "$RET" = "false" ]
then
restart="false"
fi
fi
fi
fi
if [ "$restart" = "true" ]
then
if [ -x "/usr/sbin/invoke-rc.d" ]
then
invoke-rc.d shorewall restart
else
/etc/init.d/shorewall restart
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 0
;;
esac
#DEBHELPER#