Correct 'setstatedir' functions in the init scripts

- Replaced g_program with PRODUCT
- Added setstatedir and call to ifupdown.sh

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2012-09-05 07:37:12 -07:00
parent d7354aca14
commit c13bdbd316
5 changed files with 44 additions and 28 deletions

View File

@ -22,6 +22,21 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # 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() { Debian_SuSE_ppp() {
NEWPRODUCTS= NEWPRODUCTS=
INTERFACE="$1" INTERFACE="$1"
@ -187,6 +202,8 @@ fi
[ -n "$LOGFILE" ] || LOGFILE=/dev/null [ -n "$LOGFILE" ] || LOGFILE=/dev/null
for PRODUCT in $PRODUCTS; do for PRODUCT in $PRODUCTS; do
setstatedir
if [ -x $VARLIB/$PRODUCT/firewall ]; then if [ -x $VARLIB/$PRODUCT/firewall ]; then
( ${VARLIB}/$PRODUCT/firewall -V0 $COMMAND $INTERFACE >> $LOGFILE 2>&1 ) || true ( ${VARLIB}/$PRODUCT/firewall -V0 $COMMAND $INTERFACE >> $LOGFILE 2>&1 ) || true
fi fi

View File

@ -65,11 +65,11 @@ not_configured () {
# set the STATEDIR variable # set the STATEDIR variable
setstatedir() { setstatedir() {
local statedir local statedir
if [ -f ${CONFDIR}/${g_program}/vardir ]; then if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
statedir=$( . /${CONFDIR}/${g_program}/vardir && echo $VARDIR ) statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
fi fi
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${g_program} [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
if [ ! -x $STATEDIR/firewall ]; then if [ ! -x $STATEDIR/firewall ]; then
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then

View File

@ -40,11 +40,11 @@ fi
# set the STATEDIR variable # set the STATEDIR variable
setstatedir() { setstatedir() {
local statedir local statedir
if [ -f ${CONFDIR}/${g_program}/vardir ]; then if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
statedir=$( . /${CONFDIR}/${g_program}/vardir && echo $VARDIR ) statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
fi fi
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${g_program} [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
if [ ! -x $STATEDIR/firewall ]; then if [ ! -x $STATEDIR/firewall ]; then
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then

View File

@ -35,21 +35,6 @@
# prior to bringing up the network. # prior to bringing up the network.
### END INIT INFO ### 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" ] if [ "$(id -u)" != "0" ]
then then
echo "You must be root to start, stop or restart \"Shorewall \"." echo "You must be root to start, stop or restart \"Shorewall \"."
@ -73,7 +58,21 @@ fi
# #
. /usr/share/shorewall/shorewallrc . /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 # Initialize the firewall
shorewall_start () { shorewall_start () {

View File

@ -60,11 +60,11 @@ fi
# set the STATEDIR variable # set the STATEDIR variable
setstatedir() { setstatedir() {
local statedir local statedir
if [ -f ${CONFDIR}/${g_program}/vardir ]; then if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
statedir=$( . /${CONFDIR}/${g_program}/vardir && echo $VARDIR ) statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
fi fi
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${g_program} [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
if [ ! -x $STATEDIR/firewall ]; then if [ ! -x $STATEDIR/firewall ]; then
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then