From ffc5a3c7df53fea1a9f11c7b4168083b6419eff6 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Tue, 29 May 2018 08:13:26 -0700 Subject: [PATCH] Add ALT Linux support by Alexey Shabalin Signed-off-by: Tom Eastep --- Shorewall-core/configure | 5 ++ Shorewall-core/configure.pl | 5 ++ Shorewall-core/install.sh | 7 +- Shorewall-core/shorewallrc.alt | 25 ++++++ Shorewall-init/init.alt.sh | 150 +++++++++++++++++++++++++++++++++ Shorewall-init/install.sh | 8 ++ Shorewall-lite/init.alt.sh | 117 +++++++++++++++++++++++++ Shorewall-lite/install.sh | 8 ++ Shorewall/init.alt.sh | 117 +++++++++++++++++++++++++ Shorewall/install.sh | 8 ++ Shorewall6-lite/init.alt.sh | 117 +++++++++++++++++++++++++ Shorewall6/init.alt.sh | 117 +++++++++++++++++++++++++ 12 files changed, 683 insertions(+), 1 deletion(-) create mode 100644 Shorewall-core/shorewallrc.alt create mode 100755 Shorewall-init/init.alt.sh create mode 100755 Shorewall-lite/init.alt.sh create mode 100755 Shorewall/init.alt.sh create mode 100755 Shorewall6-lite/init.alt.sh create mode 100755 Shorewall6/init.alt.sh diff --git a/Shorewall-core/configure b/Shorewall-core/configure index dee38739a..b7de802f9 100755 --- a/Shorewall-core/configure +++ b/Shorewall-core/configure @@ -109,6 +109,9 @@ if [ -z "$vendor" ]; then opensuse) vendor=suse ;; + alt|basealt|altlinux) + vendor=alt + ;; *) vendor="$ID" ;; @@ -132,6 +135,8 @@ if [ -z "$vendor" ]; then if [ -f /etc/debian_version ]; then params[HOST]=debian ls -l /sbin/init | fgrep -q systemd && rcfile=shorewallrc.debian.systemd || rcfile=shorewallrc.debian.sysvinit + elif [ -f /etc/altlinux-release ] ; then + params[HOST]=alt elif [ -f /etc/redhat-release ]; then params[HOST]=redhat rcfile=shorewallrc.redhat diff --git a/Shorewall-core/configure.pl b/Shorewall-core/configure.pl index 88f443f8e..2922ebbaf 100755 --- a/Shorewall-core/configure.pl +++ b/Shorewall-core/configure.pl @@ -74,6 +74,8 @@ unless ( defined $vendor ) { } elsif ( $id eq 'ubuntu' || $id eq 'debian' ) { my $init = `ls -l /sbin/init`; $vendor = $init =~ /systemd/ ? 'debian.systemd' : 'debian.sysvinit'; + } elsif ( $id eq 'alt' || $id eq 'basealt' || $id eq 'altlinux' ) { + $vendor = 'alt'; } else { $vendor = $id; } @@ -117,6 +119,9 @@ if ( defined $vendor ) { } else { $rcfilename = 'shorewallrc.debian.sysvinit'; } + } elsif ( -f '/etc/altlinux-release' ){ + $vendor = 'alt'; + $rcfilename = 'shorewallrc.alt'; } elsif ( -f '/etc/redhat-release' ){ $vendor = 'redhat'; $rcfilename = 'shorewallrc.redhat'; diff --git a/Shorewall-core/install.sh b/Shorewall-core/install.sh index 4622d3712..d2dffb1d6 100755 --- a/Shorewall-core/install.sh +++ b/Shorewall-core/install.sh @@ -172,6 +172,9 @@ if [ -z "$BUILD" ]; then opensuse) BUILD=suse ;; + alt|basealt|altlinux) + BUILD=alt + ;; *) BUILD="$ID" ;; @@ -180,6 +183,8 @@ if [ -z "$BUILD" ]; then BUILD=debian elif [ -f /etc/gentoo-release ]; then BUILD=gentoo + elif [ -f /etc/altlinux-release ]; then + BUILD=alt elif [ -f /etc/redhat-release ]; then BUILD=redhat elif [ -f /etc/slackware-version ] ; then @@ -238,7 +243,7 @@ case "$HOST" in apple) echo "Installing Mac-specific configuration..."; ;; - debian|gentoo|redhat|slackware|archlinux|linux|suse|openwrt) + debian|gentoo|redhat|slackware|archlinux|linux|suse|openwrt|alt) ;; *) fatal_error "Unknown HOST \"$HOST\"" diff --git a/Shorewall-core/shorewallrc.alt b/Shorewall-core/shorewallrc.alt new file mode 100644 index 000000000..5f4841c5d --- /dev/null +++ b/Shorewall-core/shorewallrc.alt @@ -0,0 +1,25 @@ +# +# ALT/BaseALT/ALTLinux Shorewall 5.2 rc file +# +BUILD= #Default is to detect the build system +HOST=alt +PREFIX=/usr #Top-level directory for shared files, libraries, etc. +SHAREDIR=${PREFIX}/share #Directory for arch-neutral files. +LIBEXECDIR=${PREFIX}/libexec #Directory for executable scripts. +PERLLIBDIR=${SHAREDIR}/perl5 #Directory to install Shorewall Perl module directory +CONFDIR=/etc #Directory where subsystem configurations are installed +SBINDIR=/sbin #Directory where system administration programs are installed +MANDIR=${SHAREDIR}/man #Directory where manpages are installed. +INITDIR=${CONFDIR}/rc.d/init.d #Directory where SysV init scripts are installed. +INITFILE=$PRODUCT #Name of the product's installed SysV init script +INITSOURCE=init.alt.sh #Name of the distributed file to be installed as the SysV init script +ANNOTATED= #If non-zero, annotated configuration files are installed +SERVICEDIR=/lib/systemd/system #Directory where .service files are installed (systems running systemd only) +SYSCONFFILE=sysconfig #Name of the distributed file to be installed as $SYSCONFDIR/$PRODUCT +SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service +SYSCONFDIR=/etc/sysconfig/ #Directory where SysV init parameter files are installed +SERVICEDIR=/lib/systemd/system #Directory where .service files are installed (systems running systemd only) +SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR +VARLIB=/var/lib #Directory where product variable data is stored. +VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored. +DEFAULT_PAGER=/usr/bin/less #Pager to use if none specified in shorewall[6].conf diff --git a/Shorewall-init/init.alt.sh b/Shorewall-init/init.alt.sh new file mode 100755 index 000000000..d4f1aff22 --- /dev/null +++ b/Shorewall-init/init.alt.sh @@ -0,0 +1,150 @@ +#!/bin/sh +# +# Shorewall init script +# +# chkconfig: - 09 91 +# description: Initialize the shorewall firewall at boot time +# +### BEGIN INIT INFO +# Provides: shorewall-init +# Required-Start: $local_fs +# Required-Stop: $local_fs +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Initialize the shorewall firewall at boot time +# Description: Place the firewall in a safe state at boot time +# prior to bringing up the network. +### END INIT INFO + +# Do not load RH compatibility interface. +WITHOUT_RC_COMPAT=1 + +# Source function library. +. /etc/init.d/functions + +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc +NAME="Shorewall-init firewall" +PROG="shorewall-init" +SHOREWALL="$SBINDIR/$PROG" +LOGGER="logger -i -t $PROG" + +# Get startup options (override default) +OPTIONS= + +LOCKFILE=/var/lock/subsys/shorewall-init + +# check if shorewall-init is configured or not +if [ -f "/etc/sysconfig/shorewall-init" ]; then + . /etc/sysconfig/shorewall-init + if [ -z "$PRODUCTS" ]; then + echo "No PRODUCTS configured" + exit 6 + fi +else + echo "/etc/sysconfig/shorewall-init not found" + exit 6 +fi + +RETVAL=0 + +# 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=${VARLIB}/${PRODUCT} + + if [ -x ${STATEDIR}/firewall ]; then + return 0 + elif [ $PRODUCT = shorewall ]; then + ${SBINDIR}/shorewall compile + elif [ $PRODUCT = shorewall6 ]; then + ${SBINDIR}/shorewall -6 compile + else + return 1 + fi +} + +start() { + local PRODUCT + local STATEDIR + + printf "Initializing \"Shorewall-based firewalls\": " + + for PRODUCT in $PRODUCTS; do + if setstatedir; then + $STATEDIR/$PRODUCT/firewall ${OPTIONS} stop 2>&1 | "$LOGGER" + RETVAL=$? + else + RETVAL=6 + break + fi + done + + if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then + ipset -R < "$SAVE_IPSETS" + fi + + [ $RETVAL -eq 0 ] && touch "$LOCKFILE" + return $RETVAL +} + +stop() { + local PRODUCT + local STATEDIR + + printf "Clearing \"Shorewall-based firewalls\": " + for PRODUCT in $PRODUCTS; do + if setstatedir; then + ${STATEDIR}/firewall ${OPTIONS} clear 2>&1 | "$LOGGER" + RETVAL=$? + else + RETVAL=6 + break + fi + done + + if [ -n "$SAVE_IPSETS" ]; then + mkdir -p $(dirname "$SAVE_IPSETS") + if ipset -S > "${SAVE_IPSETS}.tmp"; then + grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS" || rm -f "${SAVE_IPSETS}.tmp" + else + rm -f "${SAVE_IPSETS}.tmp" + fi + fi + + [ $RETVAL -eq 0 ] && rm -f "$LOCKFILE" + return $RETVAL +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload|condrestart|condreload) + # "Not implemented" + ;; + condstop) + if [ -e "$LOCKFILE" ]; then + stop + fi + ;; + status) + status "$PROG" + RETVAL=$? + ;; + *) + echo $"Usage: ${0##*/} {start|stop|restart|reload|condrestart|condstop|status}" + RETVAL=1 +esac + +exit $RETVAL diff --git a/Shorewall-init/install.sh b/Shorewall-init/install.sh index ce9ab3173..6f7a1f562 100755 --- a/Shorewall-init/install.sh +++ b/Shorewall-init/install.sh @@ -181,6 +181,9 @@ if [ -z "$BUILD" ]; then opensuse) BUILD=suse ;; + alt|basealt|altlinux) + BUILD=alt + ;; *) BUILD="$ID" ;; @@ -191,6 +194,8 @@ if [ -z "$BUILD" ]; then BUILD=debian elif [ -f /etc/gentoo-release ]; then BUILD=gentoo + elif [ -f /etc/altlinux-release ]; then + BUILD=alt elif [ -f /etc/redhat-release ]; then BUILD=redhat elif [ -f /etc/SuSE-release ]; then @@ -253,6 +258,9 @@ case "$HOST" in openwrt) echo "Installing Openwrt-specific configuration..." ;; + alt) + echo "Installing ALT-specific configuration..."; + ;; linux) fatal_error "Shorewall-init is not supported on this system" ;; diff --git a/Shorewall-lite/init.alt.sh b/Shorewall-lite/init.alt.sh new file mode 100755 index 000000000..99d0ef7ae --- /dev/null +++ b/Shorewall-lite/init.alt.sh @@ -0,0 +1,117 @@ +#!/bin/sh +# +# Shorewall-Lite init script +# +# chkconfig: - 28 90 +# description: Packet filtering firewall +# +### BEGIN INIT INFO +# Provides: shorewall-lite +# Required-Start: $local_fs $remote_fs $syslog $network +# Should-Start: $time $named +# Required-Stop: +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Packet filtering firewall +# Description: The Shoreline Firewall, more commonly known as "Shorewall", is a +# Netfilter (iptables) based firewall +### END INIT INFO + +# Do not load RH compatibility interface. +WITHOUT_RC_COMPAT=1 + +# Source function library. +. /etc/init.d/functions + +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc + +NAME="Shorewall-Lite firewall" +PROG="shorewall" +SHOREWALL="$SBINDIR/$PROG -l" +LOGGER="logger -i -t $PROG" + +# Get startup options (override default) +OPTIONS= + +SourceIfNotEmpty $SYSCONFDIR/${PROG}-lite + +LOCKFILE="/var/lock/subsys/${PROG}-lite" +RETVAL=0 + +start() { + action $"Applying $NAME rules:" "$SHOREWALL" "$OPTIONS" start "$STARTOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + [ $RETVAL -eq 0 ] && touch "$LOCKFILE" + return $RETVAL +} + +stop() { + action $"Stoping $NAME :" "$SHOREWALL" "$OPTIONS" stop "$STOPOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f "$LOCKFILE" + return $RETVAL +} + +restart() { + action $"Restarting $NAME rules: " "$SHOREWALL" "$OPTIONS" restart "$RESTARTOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + return $RETVAL +} + +reload() { + action $"Reloadinging $NAME rules: " "$SHOREWALL" "$OPTIONS" reload "$RELOADOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + return $RETVAL +} + +clear() { + action $"Clearing $NAME rules: " "$SHOREWALL" "$OPTIONS" clear 2>&1 | "$LOGGER" + RETVAL=$? + return $RETVAL +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + reload) + reload + ;; + clear) + clear + ;; + condrestart) + if [ -e "$LOCKFILE" ]; then + restart + fi + ;; + condreload) + if [ -e "$LOCKFILE" ]; then + restart + fi + ;; + condstop) + if [ -e "$LOCKFILE" ]; then + stop + fi + ;; + status) + "$SHOREWALL" status + RETVAL=$? + ;; + *) + echo $"Usage: ${0##*/} {start|stop|restart|reload|clear|condrestart|condstop|status}" + RETVAL=1 +esac + +exit $RETVAL diff --git a/Shorewall-lite/install.sh b/Shorewall-lite/install.sh index a485c5304..a69946822 100755 --- a/Shorewall-lite/install.sh +++ b/Shorewall-lite/install.sh @@ -190,6 +190,9 @@ if [ -z "$BUILD" ]; then opensuse) BUILD=suse ;; + alt|basealt|altlinux) + BUILD=alt + ;; *) BUILD="$ID" ;; @@ -198,6 +201,8 @@ if [ -z "$BUILD" ]; then BUILD=debian elif [ -f /etc/gentoo-release ]; then BUILD=gentoo + elif [ -f /etc/altlinux-release ]; then + BUILD=alt elif [ -f ${CONFDIR}/redhat-release ]; then BUILD=redhat elif [ -f ${CONFDIR}/SuSE-release ]; then @@ -266,6 +271,9 @@ case "$HOST" in openwrt) echo "Installing OpenWRT-specific configuration..." ;; + alt) + echo "Installing ALT-specific configuration..."; + ;; linux) ;; *) diff --git a/Shorewall/init.alt.sh b/Shorewall/init.alt.sh new file mode 100755 index 000000000..8f8bd7d63 --- /dev/null +++ b/Shorewall/init.alt.sh @@ -0,0 +1,117 @@ +#!/bin/sh +# +# Shorewall init script +# +# chkconfig: - 28 90 +# description: Packet filtering firewall +# +### BEGIN INIT INFO +# Provides: shorewall +# Required-Start: $local_fs $remote_fs $syslog $network +# Should-Start: $time $named +# Required-Stop: +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Packet filtering firewall +# Description: The Shoreline Firewall, more commonly known as "Shorewall", is a +# Netfilter (iptables) based firewall +### END INIT INFO + +# Do not load RH compatibility interface. +WITHOUT_RC_COMPAT=1 + +# Source function library. +. /etc/init.d/functions + +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc + +NAME="Shorewall firewall" +PROG="shorewall" +SHOREWALL="$SBINDIR/$PROG" +LOGGER="logger -i -t $PROG" + +# Get startup options (override default) +OPTIONS= + +SourceIfNotEmpty $SYSCONFDIR/$PROG + +LOCKFILE=/var/lock/subsys/shorewall +RETVAL=0 + +start() { + action $"Applying $NAME rules:" "$SHOREWALL" "$OPTIONS" start "$STARTOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + [ $RETVAL -eq 0 ] && touch "$LOCKFILE" + return $RETVAL +} + +stop() { + action $"Stoping $NAME :" "$SHOREWALL" "$OPTIONS" stop "$STOPOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f "$LOCKFILE" + return $RETVAL +} + +restart() { + action $"Restarting $NAME rules: " "$SHOREWALL" "$OPTIONS" restart "$RESTARTOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + return $RETVAL +} + +reload() { + action $"Reloading $NAME rules: " "$SHOREWALL" "$OPTIONS" reload "$RELOADOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + return $RETVAL +} + +clear() { + action $"Clearing $NAME rules: " "$SHOREWALL" "$OPTIONS" clear 2>&1 | "$LOGGER" + RETVAL=$? + return $RETVAL +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + reload) + reload + ;; + clear) + clear + ;; + condrestart) + if [ -e "$LOCKFILE" ]; then + restart + fi + ;; + condreload) + if [ -e "$LOCKFILE" ]; then + restart + fi + ;; + condstop) + if [ -e "$LOCKFILE" ]; then + stop + fi + ;; + status) + "$SHOREWALL" status + RETVAL=$? + ;; + *) + echo $"Usage: ${0##*/} {start|stop|restart|reload|clear|condrestart|condstop|status}" + RETVAL=1 +esac + +exit $RETVAL diff --git a/Shorewall/install.sh b/Shorewall/install.sh index 8de67826d..9010d2bdd 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -197,6 +197,9 @@ if [ -z "$BUILD" ]; then opensuse) BUILD=suse ;; + alt|basealt|altlinux) + BUILD=alt + ;; *) BUILD="$ID" ;; @@ -205,6 +208,8 @@ if [ -z "$BUILD" ]; then BUILD=debian elif [ -f /etc/gentoo-release ]; then BUILD=gentoo + elif [ -f /etc/altlinux-release ]; then + BUILD=alt elif [ -f /etc/redhat-release ]; then BUILD=redhat elif [ -f /etc/slackware-version ] ; then @@ -269,6 +274,9 @@ case "$HOST" in openwrt) echo "Installing OpenWRT-specific configuration..." ;; + alt) + echo "Installing ALT-specific configuration..."; + ;; linux) ;; *) diff --git a/Shorewall6-lite/init.alt.sh b/Shorewall6-lite/init.alt.sh new file mode 100755 index 000000000..3fb8d82dd --- /dev/null +++ b/Shorewall6-lite/init.alt.sh @@ -0,0 +1,117 @@ +#!/bin/sh +# +# Shorewall6-Lite init script +# +# chkconfig: - 28 90 +# description: Packet filtering firewall +# +### BEGIN INIT INFO +# Provides: shorewall6 +# Required-Start: $local_fs $remote_fs $syslog $network +# Should-Start: $time $named +# Required-Stop: +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Packet filtering firewall +# Description: The Shoreline Firewall, more commonly known as "Shorewall", is a +# Netfilter (iptables) based firewall +### END INIT INFO + +# Do not load RH compatibility interface. +WITHOUT_RC_COMPAT=1 + +# Source function library. +. /etc/init.d/functions + +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc + +NAME="Shorewall6-Lite firewall" +PROG="shorewall" +SHOREWALL="$SBINDIR/$PROG -6l" +LOGGER="logger -i -t $PROG" + +# Get startup options (override default) +OPTIONS= + +SourceIfNotEmpty $SYSCONFDIR/${PROG}6-lite + +LOCKFILE="/var/lock/subsys/${PROG}6-lite" +RETVAL=0 + +start() { + action $"Applying $NAME rules:" "$SHOREWALL" "$OPTIONS" start "$STARTOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + [ $RETVAL -eq 0 ] && touch "$LOCKFILE" + return $RETVAL +} + +stop() { + action $"Stoping $NAME :" "$SHOREWALL" "$OPTIONS" stop "$STOPOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f "$LOCKFILE" + return $RETVAL +} + +restart() { + action $"Restarting $NAME rules: " "$SHOREWALL" "$OPTIONS" restart "$RESTARTOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + return $RETVAL +} + +reload() { + action $"Reloadinging $NAME rules: " "$SHOREWALL" "$OPTIONS" reload "$RELOADOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + return $RETVAL +} + +clear() { + action $"Clearing $NAME rules: " "$SHOREWALL" "$OPTIONS" clear 2>&1 | "$LOGGER" + RETVAL=$? + return $RETVAL +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + reload) + reload + ;; + clear) + clear + ;; + condrestart) + if [ -e "$LOCKFILE" ]; then + restart + fi + ;; + condreload) + if [ -e "$LOCKFILE" ]; then + restart + fi + ;; + condstop) + if [ -e "$LOCKFILE" ]; then + stop + fi + ;; + status) + "$SHOREWALL" status + RETVAL=$? + ;; + *) + echo $"Usage: ${0##*/} {start|stop|restart|reload|clear|condrestart|condstop|status}" + RETVAL=1 +esac + +exit $RETVAL diff --git a/Shorewall6/init.alt.sh b/Shorewall6/init.alt.sh new file mode 100755 index 000000000..1d2be57ed --- /dev/null +++ b/Shorewall6/init.alt.sh @@ -0,0 +1,117 @@ +#!/bin/sh +# +# Shorewall6 init script +# +# chkconfig: - 28 90 +# description: Packet filtering firewall +# +### BEGIN INIT INFO +# Provides: shorewall6 +# Required-Start: $local_fs $remote_fs $syslog $network +# Should-Start: $time $named +# Required-Stop: +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Packet filtering firewall +# Description: The Shoreline Firewall, more commonly known as "Shorewall", is a +# Netfilter (iptables) based firewall +### END INIT INFO + +# Do not load RH compatibility interface. +WITHOUT_RC_COMPAT=1 + +# Source function library. +. /etc/init.d/functions + +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc + +NAME="Shorewall6 firewall" +PROG="shorewall" +SHOREWALL="$SBINDIR/$PROG -6" +LOGGER="logger -i -t $PROG" + +# Get startup options (override default) +OPTIONS= + +SourceIfNotEmpty $SYSCONFDIR/${PROG}6 + +LOCKFILE="/var/lock/subsys/${PROG}6" +RETVAL=0 + +start() { + action $"Applying $NAME rules:" "$SHOREWALL" "$OPTIONS" start "$STARTOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + [ $RETVAL -eq 0 ] && touch "$LOCKFILE" + return $RETVAL +} + +stop() { + action $"Stoping $NAME :" "$SHOREWALL" "$OPTIONS" stop "$STOPOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f "$LOCKFILE" + return $RETVAL +} + +restart() { + action $"Restarting $NAME rules: " "$SHOREWALL" "$OPTIONS" restart "$RESTARTOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + return $RETVAL +} + +reload() { + action $"Reloadinging $NAME rules: " "$SHOREWALL" "$OPTIONS" reload "$RELOADOPTIONS" 2>&1 | "$LOGGER" + RETVAL=$? + return $RETVAL +} + +clear() { + action $"Clearing $NAME rules: " "$SHOREWALL" "$OPTIONS" clear 2>&1 | "$LOGGER" + RETVAL=$? + return $RETVAL +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + reload) + reload + ;; + clear) + clear + ;; + condrestart) + if [ -e "$LOCKFILE" ]; then + restart + fi + ;; + condreload) + if [ -e "$LOCKFILE" ]; then + restart + fi + ;; + condstop) + if [ -e "$LOCKFILE" ]; then + stop + fi + ;; + status) + "$SHOREWALL" status + RETVAL=$? + ;; + *) + echo $"Usage: ${0##*/} {start|stop|restart|reload|clear|condrestart|condstop|status}" + RETVAL=1 +esac + +exit $RETVAL