mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-22 14:20:40 +01:00
Handle ${CONFDIR}/$PRODUCT/vardir consistently in Shorewall-init init scripts
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
f5e1a42ac9
commit
c31c9bca9c
@ -67,6 +67,8 @@ not_configured () {
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
vardir=$VARDIR
|
||||
|
||||
# check if shorewall-init is configured or not
|
||||
if [ -f "$SYSCONFDIR/shorewall-init" ]
|
||||
then
|
||||
@ -81,24 +83,27 @@ fi
|
||||
|
||||
# Initialize the firewall
|
||||
shorewall_start () {
|
||||
local product
|
||||
local PRODUCT
|
||||
local VARDIR
|
||||
|
||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||
for product in $PRODUCTS; do
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
[ -f ${CONFDIR}/$PRODUCT/vardir ] && . ${CONFDIR}/$PRODUCT/vardir
|
||||
[ -n ${VARDIR:=${vardir}/$PRODUCT} ]
|
||||
|
||||
if [ ! -x ${VARDIR}/$product/firewall ]; then
|
||||
if [ $product = shorewall -o $product = shorewall6 ]; then
|
||||
${SBINDIR}/$product compile
|
||||
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 [ -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
#
|
||||
# Run in a sub-shell to avoid name collisions
|
||||
#
|
||||
(
|
||||
if ! ${VARDIR}/$product/firewall status > /dev/null 2>&1; then
|
||||
${VARDIR}/$product/firewall stop || echo_notdone
|
||||
if ! ${VARDIR}/$PRODUCT/firewall status > /dev/null 2>&1; then
|
||||
${VARDIR}/$PRODUCT/firewall stop || echo_notdone
|
||||
fi
|
||||
)
|
||||
fi
|
||||
@ -111,18 +116,22 @@ shorewall_start () {
|
||||
|
||||
# Clear the firewall
|
||||
shorewall_stop () {
|
||||
local product
|
||||
local PRODUCT
|
||||
local VARDIR
|
||||
|
||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||
for product in $PRODUCTS; do
|
||||
if [ ! -x ${VARDIR}/$product/firewall ]; then
|
||||
if [ $product = shorewall -o $product = shorewall6 ]; then
|
||||
${SBINDIR}/$product compile
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
[ -f ${CONFDIR}/$PRODUCT/vardir ] && . ${CONFDIR}/$PRODUCT/vardir
|
||||
[ -n ${VARDIR:=${vardir}/$PRODUCT} ]
|
||||
|
||||
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
|
||||
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
${VARDIR}/$PRODUCT/firewall clear || echo_notdone
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -24,6 +24,8 @@ lockfile="/var/lock/subsys/shorewall-init"
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
vardir=$VARDIR
|
||||
|
||||
# Get startup options (override default)
|
||||
OPTIONS=
|
||||
|
||||
@ -37,7 +39,7 @@ fi
|
||||
|
||||
# Initialize the firewall
|
||||
start () {
|
||||
local product
|
||||
local PRODUCT
|
||||
local vardir
|
||||
|
||||
if [ -z "$PRODUCTS" ]; then
|
||||
@ -47,15 +49,18 @@ start () {
|
||||
fi
|
||||
|
||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||
for product in $PRODUCTS; do
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
[ -f ${CONFDIR}/$PRODUCT/vardir ] && . ${CONFDIR}/$PRODUCT/vardir
|
||||
[ -n ${VARDIR:=${vardir}/$PRODUCT} ]
|
||||
|
||||
if [ ! -x ${VARDIR}/firewall ]; then
|
||||
if [ $product = shorewall -o $product = shorewall6 ]; then
|
||||
${SBINDIR}/$product compile
|
||||
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
|
||||
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
${VARDIR}/$PRODUCT/firewall stop 2>&1 | $logger
|
||||
retval=${PIPESTATUS[0]}
|
||||
[ $retval -ne 0 ] && break
|
||||
fi
|
||||
@ -73,19 +78,22 @@ start () {
|
||||
|
||||
# Clear the firewall
|
||||
stop () {
|
||||
local product
|
||||
local PRODUCT
|
||||
local vardir
|
||||
|
||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||
for product in $PRODUCTS; do
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
[ -f ${CONFDIR}/$PRODUCT/vardir ] && . ${CONFDIR}/$PRODUCT/vardir
|
||||
[ -n ${VARDIR:=${vardir}/$PRODUCT} ]
|
||||
|
||||
if [ ! -x ${VARDIR}/firewall ]; then
|
||||
if [ $product = shorewall -o $product = shorewall6 ]; then
|
||||
${SBINDIR}/$product compile
|
||||
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
|
||||
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
${VARDIR}/$PRODUCT/firewall clear 2>&1 | $logger
|
||||
retval=${PIPESTATUS[0]}
|
||||
[ $retval -ne 0 ] && break
|
||||
fi
|
||||
|
@ -58,6 +58,8 @@ fi
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
vardir=${VARDIR}
|
||||
|
||||
# Initialize the firewall
|
||||
shorewall_start () {
|
||||
local PRODUCT
|
||||
@ -65,6 +67,9 @@ shorewall_start () {
|
||||
|
||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
[ -f ${CONFDIR}/$PRODUCT/vardir ] && . ${CONFDIR}/$PRODUCT/vardir
|
||||
[ -n ${VARDIR:=${vardir}/$PRODUCT} ]
|
||||
|
||||
if [ ! -x ${VARDIR}/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $product = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
@ -92,6 +97,9 @@ shorewall_stop () {
|
||||
|
||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
[ -f ${CONFDIR}/$PRODUCT/vardir ] && . ${CONFDIR}/$PRODUCT/vardir
|
||||
[ -n ${VARDIR:=${vardir}/$PRODUCT} ]
|
||||
|
||||
if [ ! -x ${VARDIR}/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $product = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
|
@ -57,12 +57,18 @@ fi
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
vardir=$VARDIR
|
||||
|
||||
# Initialize the firewall
|
||||
shorewall_start () {
|
||||
local PRODUCT
|
||||
local VARDIR
|
||||
|
||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
[ -f ${CONFDIR}/$PRODUCT/vardir ] && . ${CONFDIR}/$PRODUCT/vardir
|
||||
[ -n ${VARDIR:=${vardir}/$PRODUCT} ]
|
||||
|
||||
if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
@ -86,9 +92,13 @@ shorewall_start () {
|
||||
# Clear the firewall
|
||||
shorewall_stop () {
|
||||
local PRODUCT
|
||||
local VARDIR
|
||||
|
||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
[ -f ${CONFDIR}/$PRODUCT/vardir ] && . ${CONFDIR}/$PRODUCT/vardir
|
||||
[ -n ${VARDIR:=${vardir}/$PRODUCT} ]
|
||||
|
||||
if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
|
Loading…
Reference in New Issue
Block a user