mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-22 07:33:43 +01:00
Compile the firewall script if it doesn't exist
- Also cleaned up a number of defects in the init scripts Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
4f54cb34df
commit
9c6d4f90fb
@ -82,26 +82,24 @@ fi
|
||||
# Initialize the firewall
|
||||
shorewall_start () {
|
||||
local product
|
||||
local VARDIR
|
||||
|
||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||
for product in $PRODUCTS; do
|
||||
VARDIR=/var/lib/$product
|
||||
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
|
||||
if [ -x ${VARDIR}/firewall ]; then
|
||||
|
||||
if [ ! -x ${VARDIR}/$product/firewall ]; then
|
||||
if [ $product = shorewall -o $product = shorewall6 ]; then
|
||||
${SBINDIR}/$product compile
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -x ${VARDIR}/$product/firewall ]; then
|
||||
#
|
||||
# Run in a sub-shell to avoid name collisions
|
||||
#
|
||||
(
|
||||
. /usr/share/$product/lib.base
|
||||
#
|
||||
# Get mutex so the firewall state is stable
|
||||
#
|
||||
mutex_on
|
||||
if ! ${VARDIR}/firewall status > /dev/null 2>&1; then
|
||||
${VARDIR}/firewall stop || echo_notdone
|
||||
if ! ${VARDIR}/$product/firewall status > /dev/null 2>&1; then
|
||||
${VARDIR}/$product/firewall stop || echo_notdone
|
||||
fi
|
||||
mutex_off
|
||||
)
|
||||
fi
|
||||
done
|
||||
@ -114,18 +112,17 @@ shorewall_start () {
|
||||
# Clear the firewall
|
||||
shorewall_stop () {
|
||||
local product
|
||||
local VARDIR
|
||||
|
||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||
for product in $PRODUCTS; do
|
||||
VARDIR=/var/lib/$product
|
||||
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
|
||||
if [ -x ${VARDIR}/firewall ]; then
|
||||
( . /usr/share/$product/lib.base
|
||||
mutex_on
|
||||
${VARDIR}/firewall clear || echo_notdone
|
||||
mutex_off
|
||||
)
|
||||
if [ ! -x ${VARDIR}/$product/firewall ]; then
|
||||
if [ $product = shorewall -o $product = shorewall6 ]; then
|
||||
${SBINDIR}/$product compile
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -x ${VARDIR}/$product/firewall ]; then
|
||||
${VARDIR}/$product/firewall clear || echo_notdone
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -48,6 +48,12 @@ start () {
|
||||
|
||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||
for product in $PRODUCTS; do
|
||||
if [ ! -x ${VARDIR}/firewall ]; then
|
||||
if [ $product = shorewall -o $product = shorewall6 ]; then
|
||||
${SBINDIR}/$product compile
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -x ${VARDIR}/$product/firewall ]; then
|
||||
${VARDIR}/$product/firewall stop 2>&1 | $logger
|
||||
retval=${PIPESTATUS[0]}
|
||||
@ -72,6 +78,12 @@ stop () {
|
||||
|
||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||
for product in $PRODUCTS; do
|
||||
if [ ! -x ${VARDIR}/firewall ]; then
|
||||
if [ $product = shorewall -o $product = shorewall6 ]; then
|
||||
${SBINDIR}/$product compile
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -x ${VARDIR}/$product/firewall ]; then
|
||||
${VARDIR}/$product/firewall clear 2>&1 | $logger
|
||||
retval=${PIPESTATUS[0]}
|
||||
|
@ -65,6 +65,12 @@ shorewall_start () {
|
||||
|
||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if [ ! -x ${VARDIR}/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $product = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -x ${VARDIR}/firewall ]; then
|
||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||
${VARDIR}/firewall stop || echo_notdone
|
||||
@ -86,6 +92,12 @@ shorewall_stop () {
|
||||
|
||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if [ ! -x ${VARDIR}/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $product = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -x ${VARDIR}/firewall ]; then
|
||||
${VARDIR}/firewall clear || exit 1
|
||||
fi
|
||||
|
@ -60,13 +60,18 @@ fi
|
||||
# Initialize the firewall
|
||||
shorewall_start () {
|
||||
local PRODUCT
|
||||
local VARDIR
|
||||
|
||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if [ -x ${VARDIR}/firewall ]; then
|
||||
if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||
${VARDIR}/firewall stop || echo_notdone
|
||||
${VARDIR}/$PRODUCT/firewall stop || echo_notdone
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@ -81,12 +86,17 @@ shorewall_start () {
|
||||
# Clear the firewall
|
||||
shorewall_stop () {
|
||||
local PRODUCT
|
||||
local VARDIR
|
||||
|
||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if [ -x ${VARDIR}/firewall ]; then
|
||||
${VARDIR}/firewall clear || exit 1
|
||||
if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
${VARDIR}/$PRODUCT/firewall clear || exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user