mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-22 06:10:42 +01:00
Some improvements to the shorewall-init scripts.
- shorewall-init will compile if needed. - Added setting of 'vardir' to init.sh and init.suse.sh Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
eb634fa769
commit
494cdfb73c
@ -58,6 +58,8 @@ fi
|
|||||||
#
|
#
|
||||||
. /usr/share/shorewall/shorewallrc
|
. /usr/share/shorewall/shorewallrc
|
||||||
|
|
||||||
|
vardir=$VARDIR
|
||||||
|
|
||||||
# Locate the current PRODUCT's statedir
|
# Locate the current PRODUCT's statedir
|
||||||
setstatedir() {
|
setstatedir() {
|
||||||
local statedir
|
local statedir
|
||||||
@ -85,7 +87,7 @@ shorewall_start () {
|
|||||||
|
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
if [ -x ${STATEDIR}/firewall ]; then
|
||||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||||
${STATEDIR}/firewall stop || echo_notdone
|
${STATEDIR}/firewall stop || exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -70,6 +70,8 @@ fi
|
|||||||
#
|
#
|
||||||
. /usr/share/shorewall/shorewallrc
|
. /usr/share/shorewall/shorewallrc
|
||||||
|
|
||||||
|
vardir=$VARDIR
|
||||||
|
|
||||||
# set the STATEDIR variable
|
# set the STATEDIR variable
|
||||||
setstatedir() {
|
setstatedir() {
|
||||||
local statedir
|
local statedir
|
||||||
|
@ -23,11 +23,27 @@
|
|||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
#
|
#
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
# set the STATEDIR variable
|
||||||
|
setstatedir() {
|
||||||
|
local statedir
|
||||||
|
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
|
||||||
|
statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
|
||||||
|
|
||||||
|
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||||
|
${SBINDIR}/$PRODUCT compile -c || exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# This is modified by the installer when ${SHAREDIR} <> /usr/share
|
# This is modified by the installer when ${SHAREDIR} <> /usr/share
|
||||||
#
|
#
|
||||||
. /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" ]; then
|
if [ -f "$SYSCONFDIR/shorewall-init" ]; then
|
||||||
. $SYSCONFDIR/shorewall-init
|
. $SYSCONFDIR/shorewall-init
|
||||||
@ -43,14 +59,25 @@ 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
|
||||||
if [ -x ${VARDIR}/firewall ]; then
|
setstatedir
|
||||||
if ! /sbin/$PRODUCT status > /dev/null 2>&1; then
|
|
||||||
${VARDIR}/firewall stop || exit 1
|
if [ -x ${STATEDIR}/$PRODUCT/firewall ]; then
|
||||||
fi
|
#
|
||||||
|
# Run in a sub-shell to avoid name collisions
|
||||||
|
#
|
||||||
|
(
|
||||||
|
if ! ${STATEDIR}/$PRODUCT/firewall status > /dev/null 2>&1; then
|
||||||
|
${STATEDIR}/$PRODUCT/firewall stop || exit 1
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -64,14 +91,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
|
||||||
VARDIR=/var/lib/$PRODUCT
|
setstatedir
|
||||||
[ -f /etc/$PRODUCT/vardir ] && . /etc/$PRODUCT/vardir
|
|
||||||
if [ -x ${VARDIR}/firewall ]; then
|
if [ -x ${STATEDIR}/$PRODUCT/firewall ]; then
|
||||||
${VARDIR}/firewall clear || exit 1
|
${STATEDIR}/$PRODUCT/firewall clear || exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user