forked from extern/shorewall_code
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
|
# Initialize the firewall
|
||||||
shorewall_start () {
|
shorewall_start () {
|
||||||
local product
|
local product
|
||||||
local VARDIR
|
|
||||||
|
|
||||||
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
|
|
||||||
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
|
if [ ! -x ${VARDIR}/$product/firewall ]; then
|
||||||
if [ -x ${VARDIR}/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
|
# Run in a sub-shell to avoid name collisions
|
||||||
#
|
#
|
||||||
(
|
(
|
||||||
. /usr/share/$product/lib.base
|
if ! ${VARDIR}/$product/firewall status > /dev/null 2>&1; then
|
||||||
#
|
${VARDIR}/$product/firewall stop || echo_notdone
|
||||||
# Get mutex so the firewall state is stable
|
|
||||||
#
|
|
||||||
mutex_on
|
|
||||||
if ! ${VARDIR}/firewall status > /dev/null 2>&1; then
|
|
||||||
${VARDIR}/firewall stop || echo_notdone
|
|
||||||
fi
|
fi
|
||||||
mutex_off
|
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -114,18 +112,17 @@ shorewall_start () {
|
|||||||
# Clear the firewall
|
# Clear the firewall
|
||||||
shorewall_stop () {
|
shorewall_stop () {
|
||||||
local product
|
local product
|
||||||
local VARDIR
|
|
||||||
|
|
||||||
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
|
if [ $product = shorewall -o $product = shorewall6 ]; then
|
||||||
if [ -x ${VARDIR}/firewall ]; then
|
${SBINDIR}/$product compile
|
||||||
( . /usr/share/$product/lib.base
|
fi
|
||||||
mutex_on
|
fi
|
||||||
${VARDIR}/firewall clear || echo_notdone
|
|
||||||
mutex_off
|
if [ -x ${VARDIR}/$product/firewall ]; then
|
||||||
)
|
${VARDIR}/$product/firewall clear || echo_notdone
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -48,6 +48,12 @@ start () {
|
|||||||
|
|
||||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||||
for product in $PRODUCTS; do
|
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
|
if [ -x ${VARDIR}/$product/firewall ]; then
|
||||||
${VARDIR}/$product/firewall stop 2>&1 | $logger
|
${VARDIR}/$product/firewall stop 2>&1 | $logger
|
||||||
retval=${PIPESTATUS[0]}
|
retval=${PIPESTATUS[0]}
|
||||||
@ -72,6 +78,12 @@ stop () {
|
|||||||
|
|
||||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||||
for product in $PRODUCTS; do
|
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
|
if [ -x ${VARDIR}/$product/firewall ]; then
|
||||||
${VARDIR}/$product/firewall clear 2>&1 | $logger
|
${VARDIR}/$product/firewall clear 2>&1 | $logger
|
||||||
retval=${PIPESTATUS[0]}
|
retval=${PIPESTATUS[0]}
|
||||||
|
@ -65,6 +65,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
|
||||||
|
if [ ! -x ${VARDIR}/firewall ]; then
|
||||||
|
if [ $PRODUCT = shorewall -o $product = shorewall6 ]; then
|
||||||
|
${SBINDIR}/$PRODUCT compile
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -x ${VARDIR}/firewall ]; then
|
if [ -x ${VARDIR}/firewall ]; then
|
||||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||||
${VARDIR}/firewall stop || echo_notdone
|
${VARDIR}/firewall stop || echo_notdone
|
||||||
@ -86,6 +92,12 @@ shorewall_stop () {
|
|||||||
|
|
||||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
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 [ -x ${VARDIR}/firewall ]; then
|
||||||
${VARDIR}/firewall clear || exit 1
|
${VARDIR}/firewall clear || exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -60,13 +60,18 @@ fi
|
|||||||
# Initialize the firewall
|
# Initialize the firewall
|
||||||
shorewall_start () {
|
shorewall_start () {
|
||||||
local PRODUCT
|
local PRODUCT
|
||||||
local VARDIR
|
|
||||||
|
|
||||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
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
|
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||||
${VARDIR}/firewall stop || echo_notdone
|
${VARDIR}/$PRODUCT/firewall stop || echo_notdone
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -81,12 +86,17 @@ shorewall_start () {
|
|||||||
# Clear the firewall
|
# Clear the firewall
|
||||||
shorewall_stop () {
|
shorewall_stop () {
|
||||||
local PRODUCT
|
local PRODUCT
|
||||||
local VARDIR
|
|
||||||
|
|
||||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
if [ -x ${VARDIR}/firewall ]; then
|
if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||||
${VARDIR}/firewall clear || exit 1
|
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
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user