mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-22 14:20:40 +01:00
More Shorewall-init init script corrections
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
7279553be4
commit
bf70f6e71e
@ -62,6 +62,22 @@ not_configured () {
|
|||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# set the STATEDIR variable
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# The installer may alter this
|
# The installer may alter this
|
||||||
#
|
#
|
||||||
@ -84,12 +100,11 @@ fi
|
|||||||
# Initialize the firewall
|
# Initialize the firewall
|
||||||
shorewall_start () {
|
shorewall_start () {
|
||||||
local PRODUCT
|
local PRODUCT
|
||||||
local VARDIR
|
local STATEDIR
|
||||||
|
|
||||||
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
|
setstatedir
|
||||||
[ -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
|
||||||
@ -121,8 +136,7 @@ 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
|
setstatedir
|
||||||
[ -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
|
||||||
|
@ -37,6 +37,22 @@ else
|
|||||||
exit 6
|
exit 6
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# set the STATEDIR variable
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
# Initialize the firewall
|
# Initialize the firewall
|
||||||
start () {
|
start () {
|
||||||
local PRODUCT
|
local PRODUCT
|
||||||
@ -50,8 +66,7 @@ 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
|
setstatedir
|
||||||
[ -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
|
||||||
@ -83,8 +98,7 @@ 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
|
setstatedir
|
||||||
[ -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
|
||||||
|
@ -35,6 +35,21 @@
|
|||||||
# 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 \"."
|
||||||
@ -63,22 +78,15 @@ vardir=${VARDIR}
|
|||||||
# Initialize the firewall
|
# Initialize the firewall
|
||||||
shorewall_start () {
|
shorewall_start () {
|
||||||
local PRODUCT
|
local PRODUCT
|
||||||
local VARDIR
|
local STATEDIR
|
||||||
|
|
||||||
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
|
setstatedir
|
||||||
[ -n ${VARDIR:=${vardir}/$PRODUCT} ]
|
|
||||||
|
|
||||||
if [ ! -x ${VARDIR}/firewall ]; then
|
if [ -x ${STATEDIR}/firewall ]; then
|
||||||
if [ $PRODUCT = shorewall -o $product = shorewall6 ]; then
|
|
||||||
${SBINDIR}/$PRODUCT compile
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
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
|
${STATEDIR}/firewall stop || echo_notdone
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -97,8 +105,7 @@ 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
|
setstatedir
|
||||||
[ -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
|
||||||
|
@ -57,27 +57,34 @@ fi
|
|||||||
#
|
#
|
||||||
. /usr/share/shorewall/shorewallrc
|
. /usr/share/shorewall/shorewallrc
|
||||||
|
|
||||||
vardir=$VARDIR
|
# set the STATEDIR variable
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
# Initialize the firewall
|
# Initialize the firewall
|
||||||
shorewall_start () {
|
shorewall_start () {
|
||||||
local PRODUCT
|
local PRODUCT
|
||||||
local VARDIR
|
local STATEDIR
|
||||||
|
|
||||||
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
|
setstatedir
|
||||||
[ -n ${VARDIR:=${vardir}/$PRODUCT} ]
|
|
||||||
|
|
||||||
if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
|
if [ -x $STATEDIR/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}/$PRODUCT/firewall stop || echo_notdone
|
$STATEDIR/$PRODUCT/firewall stop || echo_notdone
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -92,21 +99,14 @@ shorewall_start () {
|
|||||||
# Clear the firewall
|
# Clear the firewall
|
||||||
shorewall_stop () {
|
shorewall_stop () {
|
||||||
local PRODUCT
|
local PRODUCT
|
||||||
local VARDIR
|
local STATEDIR
|
||||||
|
|
||||||
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
|
setstatedir
|
||||||
[ -n ${VARDIR:=${vardir}/$PRODUCT} ]
|
|
||||||
|
|
||||||
if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
|
if [ -x ${STATEDIR}/firewall ]; then
|
||||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
${STATEDIR}/firewall clear || exit 1
|
||||||
${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