mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-21 23:23:13 +01:00
Misc fixes to Shorewall-init
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
56318e6cc8
commit
cc72b75ba9
@ -22,6 +22,9 @@
|
|||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Get startup options (override default)
|
||||||
|
OPTIONS=
|
||||||
|
|
||||||
setstatedir() {
|
setstatedir() {
|
||||||
local statedir
|
local statedir
|
||||||
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
|
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
|
||||||
@ -30,9 +33,9 @@ setstatedir() {
|
|||||||
|
|
||||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
|
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
|
||||||
|
|
||||||
if [ ! -x $STATEDIR/firewall ]; then
|
if [ ! -x "$STATEDIR/firewall" ]; then
|
||||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
if [ $PRODUCT == shorewall -o $PRODUCT == shorewall6 ]; then
|
||||||
${SBINDIR}/$PRODUCT compile
|
${SBINDIR}/$PRODUCT $OPTIONS compile
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -99,8 +102,9 @@ esac
|
|||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
setstatedir
|
setstatedir
|
||||||
|
|
||||||
if [ -x $VARLIB/$PRODUCT/firewall ]; then
|
if [ -x "$STATEDIR/firewall" ]; then
|
||||||
( ${VARLIB}/$PRODUCT/firewall -V0 $COMMAND $INTERFACE >> $LOGFILE 2>&1 ) || true
|
echo "`date --rfc-3339=seconds` $0: Executing $STATEDIR/firewall $OPTIONS $COMMAND $INTERFACE" >> $LOGFILE 2>&1
|
||||||
|
( $STATEDIR/firewall $OPTIONS $COMMAND $INTERFACE >> $LOGFILE 2>&1 ) || true
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -45,10 +45,9 @@ setstatedir() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
|
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
|
||||||
|
if [ ! -x "${STATEDIR}/firewall" ]; then
|
||||||
if [ ! -x $STATEDIR/firewall ]; then
|
if [ $PRODUCT == shorewall -o $PRODUCT == shorewall6 ]; then
|
||||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
${SBINDIR}/$PRODUCT $OPTIONS compile
|
||||||
${SBINDIR}/$PRODUCT compile
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -65,23 +64,24 @@ start () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||||
|
retval=0
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
setstatedir
|
setstatedir
|
||||||
|
|
||||||
if [ ! -x ${VARDIR}/firewall ]; then
|
if [ ! -x "${STATEDIR}/firewall" ]; then
|
||||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
if [ $PRODUCT == shorewall -o $PRODUCT == shorewall6 ]; then
|
||||||
${SBINDIR}/$PRODUCT compile
|
${SBINDIR}/$PRODUCT $OPTIONS compile
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
|
if [ -x "${STATEDIR}/firewall" ]; then
|
||||||
${VARDIR}/$PRODUCT/firewall stop 2>&1 | $logger
|
${STATEDIR}/firewall stop 2>&1 | $logger
|
||||||
retval=${PIPESTATUS[0]}
|
retval=${PIPESTATUS[0]}
|
||||||
[ $retval -ne 0 ] && break
|
[ $retval -ne 0 ] && break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ retval -eq 0 ]; then
|
if [ $retval -eq 0 ]; then
|
||||||
touch $lockfile
|
touch $lockfile
|
||||||
success
|
success
|
||||||
else
|
else
|
||||||
@ -97,23 +97,24 @@ stop () {
|
|||||||
local vardir
|
local vardir
|
||||||
|
|
||||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||||
|
retval=0
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
setstatedir
|
setstatedir
|
||||||
|
|
||||||
if [ ! -x ${VARDIR}/firewall ]; then
|
if [ ! -x "${STATEDIR}/firewall" ]; then
|
||||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
if [ $PRODUCT == shorewall -o $PRODUCT == shorewall6 ]; then
|
||||||
${SBINDIR}/$PRODUCT compile
|
${SBINDIR}/$PRODUCT $OPTIONS compile
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
|
if [ -x "${STATEDIR}/firewall" ]; then
|
||||||
${VARDIR}/$PRODUCT/firewall clear 2>&1 | $logger
|
${STATEDIR}/firewall clear 2>&1 | $logger
|
||||||
retval=${PIPESTATUS[0]}
|
retval=${PIPESTATUS[0]}
|
||||||
[ $retval -ne 0 ] && break
|
[ $retval -ne 0 ] && break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ retval -eq 0 ]; then
|
if [ $retval -eq 0 ]; then
|
||||||
rm -f $lockfile
|
rm -f $lockfile
|
||||||
success
|
success
|
||||||
else
|
else
|
||||||
|
@ -21,3 +21,6 @@ SAVE_IPSETS=""
|
|||||||
#
|
#
|
||||||
LOGFILE=/var/log/shorewall-ifupdown.log
|
LOGFILE=/var/log/shorewall-ifupdown.log
|
||||||
|
|
||||||
|
# Startup options - set verbosity to 0 (minimal reporting)
|
||||||
|
OPTIONS="-V0"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user