diff --git a/Shorewall-init/ifupdown.sh b/Shorewall-init/ifupdown.sh index 4958bace6..4674a41bd 100644 --- a/Shorewall-init/ifupdown.sh +++ b/Shorewall-init/ifupdown.sh @@ -22,6 +22,21 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # +setstatedir() { + local statedir + if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then + statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR ) + fi + + [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT} + + if [ ! -x $STATEDIR/firewall ]; then + if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then + ${SBINDIR}/$PRODUCT compile + fi + fi +} + Debian_SuSE_ppp() { NEWPRODUCTS= INTERFACE="$1" @@ -187,6 +202,8 @@ fi [ -n "$LOGFILE" ] || LOGFILE=/dev/null for PRODUCT in $PRODUCTS; do + setstatedir + if [ -x $VARLIB/$PRODUCT/firewall ]; then ( ${VARLIB}/$PRODUCT/firewall -V0 $COMMAND $INTERFACE >> $LOGFILE 2>&1 ) || true fi diff --git a/Shorewall-init/init.debian.sh b/Shorewall-init/init.debian.sh index dd4b10b17..1586a2b7b 100755 --- a/Shorewall-init/init.debian.sh +++ b/Shorewall-init/init.debian.sh @@ -65,11 +65,11 @@ not_configured () { # set the STATEDIR variable setstatedir() { local statedir - if [ -f ${CONFDIR}/${g_program}/vardir ]; then - statedir=$( . /${CONFDIR}/${g_program}/vardir && echo $VARDIR ) + if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then + statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR ) fi - - [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${g_program} + + [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT} if [ ! -x $STATEDIR/firewall ]; then if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then diff --git a/Shorewall-init/init.fedora.sh b/Shorewall-init/init.fedora.sh index 88fe81f71..d64af5cc4 100755 --- a/Shorewall-init/init.fedora.sh +++ b/Shorewall-init/init.fedora.sh @@ -40,11 +40,11 @@ fi # set the STATEDIR variable setstatedir() { local statedir - if [ -f ${CONFDIR}/${g_program}/vardir ]; then - statedir=$( . /${CONFDIR}/${g_program}/vardir && echo $VARDIR ) + if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then + statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR ) fi - - [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${g_program} + + [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT} if [ ! -x $STATEDIR/firewall ]; then if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then diff --git a/Shorewall-init/init.sh b/Shorewall-init/init.sh index 12eeb15c2..5d721a456 100755 --- a/Shorewall-init/init.sh +++ b/Shorewall-init/init.sh @@ -35,21 +35,6 @@ # prior to bringing up the network. ### END INIT INFO -setstatedir() { - local statedir - if [ -f ${CONFDIR}/${g_program}/vardir ]; then - statedir=$( . /${CONFDIR}/${g_program}/vardir && echo $VARDIR ) - fi - - [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${g_program} - - if [ ! -x $STATEDIR/firewall ]; then - if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then - ${SBINDIR}/$PRODUCT compile - fi - fi -} - if [ "$(id -u)" != "0" ] then echo "You must be root to start, stop or restart \"Shorewall \"." @@ -73,7 +58,21 @@ fi # . /usr/share/shorewall/shorewallrc -vardir=${VARDIR} +# Locate the current PRODUCT's statedir +setstatedir() { + local statedir + if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then + statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR ) + fi + + [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT} + + if [ ! -x $STATEDIR/firewall ]; then + if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then + ${SBINDIR}/$PRODUCT compile $STATEDIR/firewall + fi + fi +} # Initialize the firewall shorewall_start () { diff --git a/Shorewall-init/init.suse.sh b/Shorewall-init/init.suse.sh index bedf38c11..56ab96496 100755 --- a/Shorewall-init/init.suse.sh +++ b/Shorewall-init/init.suse.sh @@ -60,11 +60,11 @@ fi # set the STATEDIR variable setstatedir() { local statedir - if [ -f ${CONFDIR}/${g_program}/vardir ]; then - statedir=$( . /${CONFDIR}/${g_program}/vardir && echo $VARDIR ) + if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then + statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR ) fi - - [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${g_program} + + [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT} if [ ! -x $STATEDIR/firewall ]; then if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then