From 0e8d2452d06f3132af0824e11826e4f41f5455c7 Mon Sep 17 00:00:00 2001 From: teastep Date: Sun, 22 Feb 2009 17:19:19 +0000 Subject: [PATCH] Apply the Slackware changes to trunk git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9485 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-common/init.slackware.firewall.sh | 66 ++++++++++++++++++++ Shorewall-common/init.slackware.shorewall.sh | 59 +++++++++++++++++ Shorewall-common/install.sh | 22 ++++--- Shorewall6/init.slackware.shorewall6.sh | 59 +++++++++++++++++ Shorewall6/install.sh | 14 +++-- 5 files changed, 207 insertions(+), 13 deletions(-) create mode 100755 Shorewall-common/init.slackware.firewall.sh create mode 100755 Shorewall-common/init.slackware.shorewall.sh create mode 100755 Shorewall6/init.slackware.shorewall6.sh diff --git a/Shorewall-common/init.slackware.firewall.sh b/Shorewall-common/init.slackware.firewall.sh new file mode 100755 index 000000000..c9e1626e9 --- /dev/null +++ b/Shorewall-common/init.slackware.firewall.sh @@ -0,0 +1,66 @@ +#!/bin/sh +# +# /etc/rc.d/rc.firewall: Shoreline Firewall (Shorewall) initialization script. +# +# This script starts both the IPv4 and IPv6 rules of shorewall if the respective +# initialization scripts (rc.shorewall and rc.shorewall6) are present +# +# http://rafb.net/p/k0OiyI67.html + +start() { + if [ -x /etc/rc.d/rc.shorewall ]; then + /etc/rc.d/rc.shorewall start + fi + if [ -x /etc/rc.d/rc.shorewall6 ]; then + /etc/rc.d/rc.shorewall6 start + fi +} + +stop() { + if [ -x /etc/rc.d/rc.shorewall ]; then + /etc/rc.d/rc.shorewall stop + fi + if [ -x /etc/rc.d/rc.shorewall6 ]; then + /etc/rc.d/rc.shorewall6 stop + fi +} + +restart() { + if [ -x /etc/rc.d/rc.shorewall ]; then + /etc/rc.d/rc.shorewall restart + fi + if [ -x /etc/rc.d/rc.shorewall6 ]; then + /etc/rc.d/rc.shorewall6 restart + fi +} + +status() { + if [ -x /etc/rc.d/rc.shorewall ]; then + /etc/rc.d/rc.shorewall status + fi + if [ -x /etc/rc.d/rc.shorewall6 ]; then + /etc/rc.d/rc.shorewall6 status + fi +} + +case $1 in + 'start') + start + ;; + 'stop') + stop + ;; + 'restart') + restart + ;; + 'status') + status + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + ;; +esac + +exit 0 + +# All done diff --git a/Shorewall-common/init.slackware.shorewall.sh b/Shorewall-common/init.slackware.shorewall.sh new file mode 100755 index 000000000..0ddfd3035 --- /dev/null +++ b/Shorewall-common/init.slackware.shorewall.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# +# /etc/rc.d/rc.shorewall: start/stop/restart IPv4 rules of Shorewall +# +# This should be started from rc.firewall. +# This script only affect the IPv4 rules and configuration located +# in /etc/shorewall +# +# http://rafb.net/p/iffZ4d32.html + +OPTIONS="" + +# Use /etc/default shorewall to specify $OPTIONS to run at startup, however this +# this might prevent shorewall from starting. use at your own risk +if [ -f /etc/default/shorewall ] ; then + . /etc/default/shorewall +fi + + +start() { + echo "Starting IPv4 shorewall rules..." + exec /sbin/shorewall $OPTIONS start +} + +stop() { + echo "Stopping IPv4 shorewall rules..." + exec /sbin/shorewall stop +} + +restart() { + echo "Restarting IPv4 shorewall rules..." + exec /sbin/shorewall restart +} + +status() { + exec /sbin/shorewall status +} + +case "$1" in + 'start') + start + ;; + 'stop') + stop + ;; + 'reload'|'restart') + restart + ;; + 'status') + status + ;; + *) + echo "Usage: $0 start|stop|reload|restart|status" + ;; +esac + +exit 0 + +# All done diff --git a/Shorewall-common/install.sh b/Shorewall-common/install.sh index f948be2b7..7584268f0 100755 --- a/Shorewall-common/install.sh +++ b/Shorewall-common/install.sh @@ -22,7 +22,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -VERSION=4.2.6 +VERSION=4.2.7 usage() # $1 = exit status { @@ -151,6 +151,7 @@ fi DEBIAN= CYGWIN= +MANDIR=${MANDIR:-"/usr/share/man"} case $(uname) in CYGWIN*) @@ -201,20 +202,22 @@ if [ -n "$PREFIX" ]; then if [ `id -u` != 0 ] ; then echo "Not setting file owner/group permissions, not running as root." OWNERSHIP="" - fi + fi install -d $OWNERSHIP -m 755 ${PREFIX}/sbin install -d $OWNERSHIP -m 755 ${PREFIX}${DEST} fi else - [ -x /usr/share/shorewall-perl/compiler.pl ] || \ + [ -x /usr/share/shorewall-shell/compiler -o -x /usr/share/shorewall-perl/compiler.pl ] || \ { echo " ERROR: No Shorewall compiler is installed" >&2; exit 1; } if [ -z "$CYGWIN" ]; then if [ -d /etc/apt -a -e /usr/bin/dpkg ]; then DEBIAN=yes elif [ -f /etc/slackware-version ] ; then + echo "installing Slackware specific configuration..." DEST="/etc/rc.d" - INIT="rc.firewall" + MANDIR="/usr/man" + SLACKWARE=yes elif [ -f /etc/arch-release ] ; then DEST="/etc/rc.d" INIT="shorewall" @@ -260,6 +263,9 @@ if [ -n "$DEBIAN" ]; then install_file_with_backup init.debian.sh /etc/init.d/shorewall 0544 ${PREFIX}/usr/share/shorewall-${VERSION}.bkout elif [ -n "$ARCHLINUX" ]; then install_file_with_backup init.archlinux.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall-${VERSION}.bkout +elif [ -n "$SLACKWARE" ]; then + install_file_with_backup init.slackware.firewall.sh ${PREFIX}${DEST}/rc.firewall 0644 ${PREFIX}/usr/share/shorewall-${VERSION}.bkout + install_file_with_backup init.slackware.shorewall.sh ${PREFIX}${DEST}/rc.shorewall 0644 ${PREFIX}/usr/share/shorewall-${VERSION}.bkout elif [ -n "$INIT" ]; then install_file_with_backup init.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall-${VERSION}.bkout fi @@ -732,14 +738,14 @@ cd manpages for f in *.5; do gzip -c $f > $f.gz - run_install -D -m 0644 $f.gz ${PREFIX}/usr/share/man/man5/$f.gz - echo "Man page $f.gz installed to /usr/share/man/man5/$f.gz" + run_install -D -m 0644 $f.gz ${PREFIX}${MANDIR}/man5/$f.gz + echo "Man page $f.gz installed to ${PREFIX}${MANDIR}/man5/$f.gz" done for f in *.8; do gzip -c $f > $f.gz - run_install -D -m 0644 $f.gz ${PREFIX}/usr/share/man/man8/$f.gz - echo "Man page $f.gz installed to /usr/share/man/man8/$f.gz" + run_install -D -m 0644 $f.gz ${PREFIX}${MANDIR}/man8/$f.gz + echo "Man page $f.gz installed to ${PREFIX}${MANDIR}/man8/$f.gz" done cd .. diff --git a/Shorewall6/init.slackware.shorewall6.sh b/Shorewall6/init.slackware.shorewall6.sh new file mode 100755 index 000000000..5832c3b7e --- /dev/null +++ b/Shorewall6/init.slackware.shorewall6.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# +# /etc/rc.d/rc.shorewall6: start/stop/restart IPv6 rules of Shorewall +# +# This should be started from rc.firewall. +# This script only affect the IPv6 rules and configuration located +# in /etc/shorewall6 +# +# http://rafb.net/p/1gsyye11.html + +OPTIONS="" + +# Use /etc/default shorewall6 to specify $OPTIONS to run at startup, however this +# this might prevent shorewall6 from starting. use at your own risk +if [ -f /etc/default/shorewall6 ] ; then + . /etc/default/shorewall6 +fi + + +start() { + echo "Starting IPv6 shorewall rules..." + exec /sbin/shorewall6 $OPTIONS start +} + +stop() { + echo "Stopping IPv6 shorewall rules..." + exec /sbin/shorewall6 stop +} + +restart() { + echo "Restarting IPv6 shorewall rules..." + exec /sbin/shorewall6 restart +} + +status() { + exec /sbin/shorewall6 status +} + +case "$1" in + 'start') + start + ;; + 'stop') + stop + ;; + 'reload'|'restart') + restart + ;; + 'status') + status + ;; + *) + echo "Usage: $0 start|stop|reload|restart|status" + ;; +esac + +exit 0 + +# All done diff --git a/Shorewall6/install.sh b/Shorewall6/install.sh index 78c4c6cc0..e22a9ca1a 100755 --- a/Shorewall6/install.sh +++ b/Shorewall6/install.sh @@ -151,6 +151,7 @@ fi DEBIAN= CYGWIN= +MANDIR=$(MANDIR:-"/usr/share/man") case $(uname) in CYGWIN*) @@ -214,6 +215,7 @@ else DEBIAN=yes elif [ -f /etc/slackware-version ] ; then DEST="/etc/rc.d" + SLACKWARE=yes INIT="rc.firewall" elif [ -f /etc/arch-release ] ; then DEST="/etc/rc.d" @@ -258,6 +260,8 @@ fi # if [ -n "$DEBIAN" ]; then install_file_with_backup init.debian.sh /etc/init.d/shorewall6 0544 ${PREFIX}/usr/share/shorewall6-${VERSION}.bkout +elif [ -n "$SLACKWARE" ]; then + install_file_with_backup init.slackware.shorewall6.sh ${PREFIX}${DEST}/rc.shorewall6 0544 ${PREFIX}/usr/share/shorewall6-${VERSION}.bkout elif [ -n "$ARCHLINUX" ]; then install_file_with_backup init.archlinux.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall6-${VERSION}.bkout elif [ -n "$INIT" ]; then @@ -478,7 +482,7 @@ fi # # Install the Notrack file # -run_install $OWNERSHIP -m 0644 notrack ${PREFIX}/usr/share/shorewall6/configfiles/notrack +run_install $OWNERSHIP -m 0644 notrack ${PREFIX}/usr/share/shorewal6/configfiles/notrack if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/notrack ]; then run_install $OWNERSHIP -m 0600 notrack ${PREFIX}/etc/shorewall6/notrack @@ -626,14 +630,14 @@ cd manpages for f in *.5; do gzip -c $f > $f.gz - run_install -D -m 0644 $f.gz ${PREFIX}/usr/share/man/man5/$f.gz - echo "Man page $f.gz installed to /usr/share/man/man5/$f.gz" + run_install -D -m 0644 $f.gz ${PREFIX}${MANDIR}/man5/$f.gz + echo "Man page $f.gz installed to ${PREFIX}${MANDIR}/man5/$f.gz" done for f in *.8; do gzip -c $f > $f.gz - run_install -D -m 0644 $f.gz ${PREFIX}/usr/share/man/man8/$f.gz - echo "Man page $f.gz installed to /usr/share/man/man8/$f.gz" + run_install -D -m 0644 $f.gz ${PREFIX}${MANDIR}/man/man8/$f.gz + echo "Man page $f.gz installed to ${PREFIX}${MANDIR}/man8/$f.gz" done cd ..