Skip to content

Commit

Permalink
Added shorewall
Browse files Browse the repository at this point in the history
  • Loading branch information
conraid committed Feb 11, 2015
1 parent a5bf8ee commit 7f7c99b
Show file tree
Hide file tree
Showing 13 changed files with 444 additions and 0 deletions.
10 changes: 10 additions & 0 deletions shorewall-core/PKGNOTE
@@ -0,0 +1,10 @@

shorewall consists of 3 packages:
* shorewall-core, containing the common elements to both IPv4 and IPv6 components
* shorewall, the IPv4 component
* shorewall6, the IPv6 component

The shorewall-core package is needed for both,
but you must install at least one of the other two,
depending on your network type.

26 changes: 26 additions & 0 deletions shorewall-core/doinst.sh
@@ -0,0 +1,26 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}

perms() {
# Keep same perms on file
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ -e $OLD ]; then
cp -a $OLD $NEW.incoming
cat $NEW > $NEW.incoming
mv $NEW.incoming $NEW
fi
config $NEW
}

perms etc/rc.d/rc.firewall.new
86 changes: 86 additions & 0 deletions shorewall-core/shorewall-core.SlackBuild
@@ -0,0 +1,86 @@
#!/bin/sh
#
# Slackware build script for shorewall-core
#
# Copyright 2015 Corrado Franco (http://conraid.net)
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Latest version of this SlackBuild at http://slackers.it/repository

# Exit on most errors
set -eu

# Set variables:
CWD=$(pwd)

PRGNAME=${PRGNAME:-shorewall-core}
PKGNAME=$(echo $PRGNAME | tr A-Z a-z)
VERSION=${VERSION:-4.6.6.2}
PKGVERSION=$(echo $VERSION | tr - _)
BUILD=${BUILD:-1}
ARCH=${ARCH:="noarch"}
TAG=${TAG:-cf}
TMP=${TMP:-/tmp/pkg}
PKG=$TMP/package-$PKGNAME
DOCS="$PKG/usr/doc/$PKGNAME-$PKGVERSION"

# Insert document files in this variable
DOCFILES="COPYING INSTALL *.txt"

# Extract source and prepare:
rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
rm -rf $PRGNAME-$VERSION
tar xvf $CWD/$PRGNAME-$VERSION.tar.bz2
cd $PRGNAME-$VERSION

# Make sure ownerships and permissions are sane:
chown -R root:root .
chmod -R u+w,go+r-w,a-s .

# Configure
./configure

# install:
DESTDIR=$PKG ./install.sh

# Remove empty directories
find $PKG -depth -type d -empty -delete || true

# Rename init script
mv $PKG/etc/rc.d/rc.firewall $PKG/etc/rc.d/rc.firewall.new

# Add a documentation directory:
mkdir -p ${DOCS}
cp -a $DOCFILES $DOCS || true

# Add a slackbuild script:
install -Dm644 $CWD/$PKGNAME.SlackBuild $DOCS/$PKGNAME.SlackBuild

# Add slack-desc
install -Dm644 $CWD/slack-desc $PKG/install/slack-desc

# Add a doinst.sh
install -Dm644 $CWD/doinst.sh $PKG/install/doinst.sh

# Create package:
cd $PKG
/sbin/makepkg -l y -c n $CWD/$PKGNAME-$PKGVERSION-$ARCH-${BUILD}${TAG}.txz
8 changes: 8 additions & 0 deletions shorewall-core/shorewall-core.info
@@ -0,0 +1,8 @@
NAME="shorewall-core"
VERSION="4.6.6.2"
HOMEPAGE="http://www.shorewall.net"
DOWNLOAD="http://www.shorewall.net/pub/shorewall/4.6/shorewall-4.6.6/shorewall-core-4.6.6.2.tar.bz2"
REQUIRES=""
MD5SUM="1b0b7d0af75971b558b2562d55d0d0ef"
SHASUM="a7884d968708b45c303f024a3bd8e48d4db9da64"

19 changes: 19 additions & 0 deletions shorewall-core/slack-desc
@@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.

|-----handy-ruler------------------------------------------------------|
shorewall-core: Shorewall-core (Core Shorewall libraries)
shorewall-core:
shorewall-core: The Shoreline Firewall, more commonly known as "Shorewall",
shorewall-core: is a Netfilter (iptables) based firewall that can be used on
shorewall-core: a dedicated firewall system, a multi-function gateway /
shorewall-core: router / server, or on a standalone GNU/Linux system.
shorewall-core:
shorewall-core: This package contains common files required by both the
shorewall-core: shorewall and shorewall6 components of Shorewall.
shorewall-core:
shorewall-core:
27 changes: 27 additions & 0 deletions shorewall/doinst.sh
@@ -0,0 +1,27 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}

perms() {
# Keep same perms on file
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ -e $OLD ]; then
cp -a $OLD $NEW.incoming
cat $NEW > $NEW.incoming
mv $NEW.incoming $NEW
fi
config $NEW
}

perms etc/rc.d/rc.shorewall.new
perms etc/logrotate.d/shorewall.new
92 changes: 92 additions & 0 deletions shorewall/shorewall.SlackBuild
@@ -0,0 +1,92 @@
#!/bin/sh
#
# Slackware build script for shorewall
#
# Copyright 2015 Corrado Franco (http://conraid.net)
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Latest version of this SlackBuild at http://slackers.it/repository

# Exit on most errors
set -eu

# Set variables:
CWD=$(pwd)

PRGNAME=${PRGNAME:-shorewall}
PKGNAME=$(echo $PRGNAME | tr A-Z a-z)
VERSION=${VERSION:-4.6.6.2}
PKGVERSION=$(echo $VERSION | tr - _)
BUILD=${BUILD:-1}
ARCH=${ARCH:="noarch"}
TAG=${TAG:-cf}
TMP=${TMP:-/tmp/pkg}
PKG=$TMP/package-$PKGNAME
DOCS="$PKG/usr/doc/$PKGNAME-$PKGVERSION"

# Insert document files in this variable
DOCFILES="COPYING INSTALL *.txt Samples"

# Extract source and prepare:
rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
rm -rf $PRGNAME-$VERSION
tar xvf $CWD/$PRGNAME-$VERSION.tar.bz2
cd $PRGNAME-$VERSION

# Make sure ownerships and permissions are sane:
chown -R root:root .
chmod -R u+w,go+r-w,a-s .

# Configure
./configure

# install:
DESTDIR=$PKG ./install.sh

# Rename script and configuration files
mv $PKG/etc/rc.d/rc.shorewall $PKG/etc/rc.d/rc.shorewall.new
mv $PKG/etc/logrotate.d/shorewall $PKG/etc/logrotate.d/shorewall.new
for FILE in $(ls $PKG/etc/shorewall/[a-z]*) ; do
mv $FILE $FILE.new
done

# Add a documentation directory:
mkdir -p ${DOCS}
cp -a $DOCFILES $DOCS || true

# Add a slackbuild script:
install -Dm644 $CWD/$PKGNAME.SlackBuild $DOCS/$PKGNAME.SlackBuild

# Add slack-desc
install -Dm644 $CWD/slack-desc $PKG/install/slack-desc

# Add a doinst.sh
install -Dm644 $CWD/doinst.sh $PKG/install/doinst.sh

# Add config files in doinst.sh (thanks to SBo)
for NEW in $PKG/etc/shorewall/*.new; do
echo $NEW | sed 's/.*etc/config etc/' >> $PKG/install/doinst.sh
done

# Create package:
cd $PKG
/sbin/makepkg -l y -c n $CWD/$PKGNAME-$PKGVERSION-$ARCH-${BUILD}${TAG}.txz
8 changes: 8 additions & 0 deletions shorewall/shorewall.info
@@ -0,0 +1,8 @@
NAME="shorewall"
VERSION="4.6.6.2"
HOMEPAGE="http://www.shorewall.net"
DOWNLOAD="http://www.shorewall.net/pub/shorewall/4.6/shorewall-4.6.6/shorewall-4.6.6.2.tar.bz2"
REQUIRES="shorewall-core"
MD5SUM="5ba6cfa277e0cac55611d5ef5a8df48d"
SHASUM="ec63714e16407ce56f21cc9b6fea3ee1e59badfb"

19 changes: 19 additions & 0 deletions shorewall/slack-desc
@@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.

|-----handy-ruler------------------------------------------------------|
shorewall: Shorewall (An iptables-based firewall for Linux systems)
shorewall:
shorewall: The Shoreline Firewall, more commonly known as "Shorewall", is a
shorewall: Netfilter (iptables) based firewall that can be used on a dedicated
shorewall: firewall system, a multi-function gateway/router/server or on a
shorewall: standalone GNU/Linux system.
shorewall:
shorewall: This package provides the IPv4 components for shorewall.
shorewall:
shorewall:
shorewall:
27 changes: 27 additions & 0 deletions shorewall6/doinst.sh
@@ -0,0 +1,27 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}

perms() {
# Keep same perms on file
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ -e $OLD ]; then
cp -a $OLD $NEW.incoming
cat $NEW > $NEW.incoming
mv $NEW.incoming $NEW
fi
config $NEW
}

perms etc/rc.d/rc.shorewall6.new
perms etc/logrotate.d/shorewall6.new

0 comments on commit 7f7c99b

Please sign in to comment.