Modify RedHat/Fedora init scripts for shorewallrc.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2012-03-26 07:20:31 -07:00
parent c23deed3a7
commit 2518c653af
5 changed files with 56 additions and 20 deletions

View File

@ -13,6 +13,15 @@
# Description: Place the firewall in a safe state at boot time # Description: Place the firewall in a safe state at boot time
# prior to bringing up the network. # prior to bringing up the network.
### END INIT INFO ### END INIT INFO
#determine where the files were installed
if [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
else
SBINDIR=/sbin
SYSCONFDIR=/etc/default
VARDIR=/var/lib
fi
prog="shorewall-init" prog="shorewall-init"
logger="logger -i -t $prog" logger="logger -i -t $prog"
lockfile="/var/lock/subsys/shorewall-init" lockfile="/var/lock/subsys/shorewall-init"
@ -44,10 +53,8 @@ start () {
echo -n "Initializing \"Shorewall-based firewalls\": " echo -n "Initializing \"Shorewall-based firewalls\": "
for product in $PRODUCTS; do for product in $PRODUCTS; do
vardir=/var/lib/$product if [ -x ${VARDIR}/$product/firewall ]; then
[ -f /etc/$product/vardir ] && . /etc/$product/vardir ${VARDIR}/$product/firewall stop 2>&1 | $logger
if [ -x ${vardir}/firewall ]; then
${vardir}/firewall stop 2>&1 | $logger
retval=${PIPESTATUS[0]} retval=${PIPESTATUS[0]}
[ retval -ne 0 ] && break [ retval -ne 0 ] && break
fi fi
@ -70,10 +77,8 @@ stop () {
echo -n "Clearing \"Shorewall-based firewalls\": " echo -n "Clearing \"Shorewall-based firewalls\": "
for product in $PRODUCTS; do for product in $PRODUCTS; do
vardir=/var/lib/$product if [ -x ${VARDIR}/$product/firewall ]; then
[ -f /etc/$product/vardir ] && . /etc/$product/vardir ${VARDIR}/$product/firewall clear 2>&1 | $logger
if [ -x ${vardir}/firewall ]; then
${vardir}/firewall clear 2>&1 | $logger
retval=${PIPESTATUS[0]} retval=${PIPESTATUS[0]}
[ retval -ne 0 ] && break [ retval -ne 0 ] && break
fi fi

View File

@ -20,16 +20,24 @@
# Source function library. # Source function library.
. /etc/rc.d/init.d/functions . /etc/rc.d/init.d/functions
#determine where the files were installed
if [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
else
SBINDIR=/sbin
SYSCONFDIR=/etc/default
fi
prog="shorewall-lite" prog="shorewall-lite"
shorewall="/sbin/$prog" shorewall="${SBINDIR}/$prog"
logger="logger -i -t $prog" logger="logger -i -t $prog"
lockfile="/var/lock/subsys/$prog" lockfile="/var/lock/subsys/$prog"
# Get startup options (override default) # Get startup options (override default)
OPTIONS= OPTIONS=
if [ -f /etc/sysconfig/$prog ]; then if [ -f ${SYSCONFDIR}/$prog ]; then
. /etc/sysconfig/$prog . ${SYSCONFDIR}/$prog
fi fi
start() { start() {

View File

@ -20,16 +20,24 @@
# Source function library. # Source function library.
. /etc/rc.d/init.d/functions . /etc/rc.d/init.d/functions
#determine where the files were installed
if [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
else
SBINDIR=/sbin
SYSCONFDIR=/etc/default
fi
prog="shorewall" prog="shorewall"
shorewall="/sbin/$prog" shorewall="${SBINDIR}/$prog"
logger="logger -i -t $prog" logger="logger -i -t $prog"
lockfile="/var/lock/subsys/$prog" lockfile="/var/lock/subsys/$prog"
# Get startup options (override default) # Get startup options (override default)
OPTIONS= OPTIONS=
if [ -f /etc/sysconfig/$prog ]; then if [ -f ${SYSCONFDIR}/$prog ]; then
. /etc/sysconfig/$prog . ${SYSCONFDIR}/$prog
fi fi
start() { start() {

View File

@ -20,16 +20,24 @@
# Source function library. # Source function library.
. /etc/rc.d/init.d/functions . /etc/rc.d/init.d/functions
#determine where the files were installed
if [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
else
SBINDIR=/sbin
SYSCONFDIR=/etc/default
fi
prog="shorewall6-lite" prog="shorewall6-lite"
shorewall="/sbin/$prog" shorewall="${SBINDIR}/$prog"
logger="logger -i -t $prog" logger="logger -i -t $prog"
lockfile="/var/lock/subsys/$prog" lockfile="/var/lock/subsys/$prog"
# Get startup options (override default) # Get startup options (override default)
OPTIONS= OPTIONS=
if [ -f /etc/sysconfig/$prog ]; then if [ -f ${SYSCONFDIR}/$prog ]; then
. /etc/sysconfig/$prog . ${SYSCONFDIR}/$prog
fi fi
start() { start() {

View File

@ -20,16 +20,23 @@
# Source function library. # Source function library.
. /etc/rc.d/init.d/functions . /etc/rc.d/init.d/functions
#determine where the files were installed
if [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
else
SBINDIR=/sbin
SYSCONFDIR=/etc/default
fi
prog="shorewall6" prog="shorewall6"
shorewall="/sbin/$prog" shorewall="${SBINDIR}/$prog"
logger="logger -i -t $prog" logger="logger -i -t $prog"
lockfile="/var/lock/subsys/$prog" lockfile="/var/lock/subsys/$prog"
# Get startup options (override default) # Get startup options (override default)
OPTIONS= OPTIONS=
if [ -f /etc/sysconfig/$prog ]; then if [ -f ${SYSCONFDIR}/$prog ]; then
. /etc/sysconfig/$prog . ${SYSCONFDIR}/$prog
fi fi
start() { start() {