mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-03 03:59:16 +01:00
Shorewall-init improvements
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
7a9270136c
commit
548c0558c1
@ -74,7 +74,9 @@ setstatedir() {
|
|||||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
||||||
|
|
||||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||||
${SBINDIR}/$PRODUCT ${OPTIONS} compile -c || echo_notdone
|
${SBINDIR}/$PRODUCT ${OPTIONS} compile -c
|
||||||
|
else
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,21 +105,17 @@ shorewall_start () {
|
|||||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||||
|
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
setstatedir
|
if setstatedir; then
|
||||||
|
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
if [ -x ${STATEDIR}/firewall ]; then
|
||||||
#
|
#
|
||||||
# Run in a sub-shell to avoid name collisions
|
# Run in a sub-shell to avoid name collisions
|
||||||
#
|
#
|
||||||
(
|
(
|
||||||
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
|
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
|
||||||
${STATEDIR}/firewall ${OPTIONS} stop || echo_notdone
|
${STATEDIR}/firewall ${OPTIONS} stop
|
||||||
else
|
|
||||||
echo_notdone
|
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
else
|
fi
|
||||||
echo_notdone
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -144,10 +142,10 @@ shorewall_stop () {
|
|||||||
|
|
||||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
setstatedir
|
if setstatedir; then
|
||||||
|
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
if [ -x ${STATEDIR}/firewall ]; then
|
||||||
${STATEDIR}/firewall ${OPTIONS} clear || echo_notdone
|
${STATEDIR}/firewall ${OPTIONS} clear
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -69,10 +69,10 @@ setstatedir() {
|
|||||||
|
|
||||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
||||||
|
|
||||||
if [ ! -x $STATEDIR/firewall ]; then
|
|
||||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||||
${SBINDIR}/$PRODUCT ${OPTIONS} compile $STATEDIR/firewall
|
${SBINDIR}/$PRODUCT ${OPTIONS} compile $STATEDIR/firewall
|
||||||
fi
|
else
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,11 +83,11 @@ shorewall_start () {
|
|||||||
|
|
||||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
setstatedir
|
if setstatedir; then
|
||||||
|
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
if [ -x ${STATEDIR}/firewall ]; then
|
||||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||||
${STATEDIR}/firewall ${OPTIONS} stop || exit 1
|
${STATEDIR}/firewall ${OPTIONS} stop
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -106,10 +106,10 @@ shorewall_stop () {
|
|||||||
|
|
||||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
setstatedir
|
if setstatedir; then
|
||||||
|
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
if [ -x ${STATEDIR}/firewall ]; then
|
||||||
${STATEDIR}/firewall ${OPTIONS} clear || exit 1
|
${STATEDIR}/firewall ${OPTIONS} clear
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -80,7 +80,9 @@ setstatedir() {
|
|||||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
||||||
|
|
||||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||||
${SBINDIR}/$PRODUCT ${OPTIONS} compile -c || exit
|
${SBINDIR}/$PRODUCT ${OPTIONS} compile -c
|
||||||
|
else
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,14 +93,12 @@ shorewall_start () {
|
|||||||
|
|
||||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
setstatedir
|
if setstatedir; then
|
||||||
|
|
||||||
if [ -x $STATEDIR/firewall ]; then
|
if [ -x $STATEDIR/firewall ]; then
|
||||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||||
$STATEDIR/$PRODUCT/firewall ${OPTIONS} stop || exit
|
$STATEDIR/$PRODUCT/firewall ${OPTIONS} stop
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
exit 6
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -114,12 +114,10 @@ shorewall_stop () {
|
|||||||
|
|
||||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
setstatedir
|
if setstatedir; then
|
||||||
|
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
if [ -x ${STATEDIR}/firewall ]; then
|
||||||
${STATEDIR}/firewall ${OPTIONS} clear || exit
|
${STATEDIR}/firewall ${OPTIONS} clear
|
||||||
else
|
fi
|
||||||
exit 6
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user