forked from extern/shorewall_code
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
|
. /usr/share/shorewall/shorewallrc
|
||||||
|
|
||||||
|
vardir=$VARDIR
|
||||||
|
|
||||||
# check if shorewall-init is configured or not
|
# check if shorewall-init is configured or not
|
||||||
if [ -f "$SYSCONFDIR/shorewall-init" ]
|
if [ -f "$SYSCONFDIR/shorewall-init" ]
|
||||||
then
|
then
|
||||||
@ -81,24 +83,27 @@ 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
|
||||||
|
[ -f ${CONFDIR}/$PRODUCT/vardir ] && . ${CONFDIR}/$PRODUCT/vardir
|
||||||
|
[ -n ${VARDIR:=${vardir}/$PRODUCT} ]
|
||||||
|
|
||||||
if [ ! -x ${VARDIR}/$product/firewall ]; then
|
if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||||
if [ $product = shorewall -o $product = shorewall6 ]; then
|
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||||
${SBINDIR}/$product compile
|
${SBINDIR}/$PRODUCT compile
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -x ${VARDIR}/$product/firewall ]; then
|
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||||
#
|
#
|
||||||
# Run in a sub-shell to avoid name collisions
|
# Run in a sub-shell to avoid name collisions
|
||||||
#
|
#
|
||||||
(
|
(
|
||||||
if ! ${VARDIR}/$product/firewall status > /dev/null 2>&1; then
|
if ! ${VARDIR}/$PRODUCT/firewall status > /dev/null 2>&1; then
|
||||||
${VARDIR}/$product/firewall stop || echo_notdone
|
${VARDIR}/$PRODUCT/firewall stop || echo_notdone
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
@ -111,18 +116,22 @@ 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}/$product/firewall ]; then
|
[ -f ${CONFDIR}/$PRODUCT/vardir ] && . ${CONFDIR}/$PRODUCT/vardir
|
||||||
if [ $product = shorewall -o $product = shorewall6 ]; then
|
[ -n ${VARDIR:=${vardir}/$PRODUCT} ]
|
||||||
${SBINDIR}/$product compile
|
|
||||||
|
if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||||
|
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||||
|
${SBINDIR}/$PRODUCT compile
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -x ${VARDIR}/$product/firewall ]; then
|
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||||
${VARDIR}/$product/firewall clear || echo_notdone
|
${VARDIR}/$PRODUCT/firewall clear || echo_notdone
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@ lockfile="/var/lock/subsys/shorewall-init"
|
|||||||
# Source function library.
|
# Source function library.
|
||||||
. /etc/rc.d/init.d/functions
|
. /etc/rc.d/init.d/functions
|
||||||
|
|
||||||
|
vardir=$VARDIR
|
||||||
|
|
||||||
# Get startup options (override default)
|
# Get startup options (override default)
|
||||||
OPTIONS=
|
OPTIONS=
|
||||||
|
|
||||||
@ -37,7 +39,7 @@ fi
|
|||||||
|
|
||||||
# Initialize the firewall
|
# Initialize the firewall
|
||||||
start () {
|
start () {
|
||||||
local product
|
local PRODUCT
|
||||||
local vardir
|
local vardir
|
||||||
|
|
||||||
if [ -z "$PRODUCTS" ]; then
|
if [ -z "$PRODUCTS" ]; then
|
||||||
@ -47,15 +49,18 @@ start () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
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 [ ! -x ${VARDIR}/firewall ]; then
|
||||||
if [ $product = shorewall -o $product = shorewall6 ]; then
|
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||||
${SBINDIR}/$product compile
|
${SBINDIR}/$PRODUCT compile
|
||||||
fi
|
fi
|
||||||
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]}
|
||||||
[ $retval -ne 0 ] && break
|
[ $retval -ne 0 ] && break
|
||||||
fi
|
fi
|
||||||
@ -73,19 +78,22 @@ start () {
|
|||||||
|
|
||||||
# Clear the firewall
|
# Clear the firewall
|
||||||
stop () {
|
stop () {
|
||||||
local product
|
local PRODUCT
|
||||||
local vardir
|
local vardir
|
||||||
|
|
||||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
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 [ ! -x ${VARDIR}/firewall ]; then
|
||||||
if [ $product = shorewall -o $product = shorewall6 ]; then
|
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||||
${SBINDIR}/$product compile
|
${SBINDIR}/$PRODUCT compile
|
||||||
fi
|
fi
|
||||||
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]}
|
||||||
[ $retval -ne 0 ] && break
|
[ $retval -ne 0 ] && break
|
||||||
fi
|
fi
|
||||||
|
@ -58,6 +58,8 @@ fi
|
|||||||
#
|
#
|
||||||
. /usr/share/shorewall/shorewallrc
|
. /usr/share/shorewall/shorewallrc
|
||||||
|
|
||||||
|
vardir=${VARDIR}
|
||||||
|
|
||||||
# Initialize the firewall
|
# Initialize the firewall
|
||||||
shorewall_start () {
|
shorewall_start () {
|
||||||
local PRODUCT
|
local PRODUCT
|
||||||
@ -65,6 +67,9 @@ shorewall_start () {
|
|||||||
|
|
||||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
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 [ ! -x ${VARDIR}/firewall ]; then
|
||||||
if [ $PRODUCT = shorewall -o $product = shorewall6 ]; then
|
if [ $PRODUCT = shorewall -o $product = shorewall6 ]; then
|
||||||
${SBINDIR}/$PRODUCT compile
|
${SBINDIR}/$PRODUCT compile
|
||||||
@ -92,6 +97,9 @@ shorewall_stop () {
|
|||||||
|
|
||||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
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 [ ! -x ${VARDIR}/firewall ]; then
|
||||||
if [ $PRODUCT = shorewall -o $product = shorewall6 ]; then
|
if [ $PRODUCT = shorewall -o $product = shorewall6 ]; then
|
||||||
${SBINDIR}/$PRODUCT compile
|
${SBINDIR}/$PRODUCT compile
|
||||||
|
@ -57,12 +57,18 @@ fi
|
|||||||
#
|
#
|
||||||
. /usr/share/shorewall/shorewallrc
|
. /usr/share/shorewall/shorewallrc
|
||||||
|
|
||||||
|
vardir=$VARDIR
|
||||||
|
|
||||||
# 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
|
||||||
|
[ -f ${CONFDIR}/$PRODUCT/vardir ] && . ${CONFDIR}/$PRODUCT/vardir
|
||||||
|
[ -n ${VARDIR:=${vardir}/$PRODUCT} ]
|
||||||
|
|
||||||
if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
|
if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||||
${SBINDIR}/$PRODUCT compile
|
${SBINDIR}/$PRODUCT compile
|
||||||
@ -86,9 +92,13 @@ 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
|
||||||
|
[ -f ${CONFDIR}/$PRODUCT/vardir ] && . ${CONFDIR}/$PRODUCT/vardir
|
||||||
|
[ -n ${VARDIR:=${vardir}/$PRODUCT} ]
|
||||||
|
|
||||||
if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
|
if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||||
${SBINDIR}/$PRODUCT compile
|
${SBINDIR}/$PRODUCT compile
|
||||||
|
Loading…
Reference in New Issue
Block a user