summaryrefslogtreecommitdiffstats
path: root/network/fail2ban/fail2ban.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'network/fail2ban/fail2ban.SlackBuild')
-rw-r--r--network/fail2ban/fail2ban.SlackBuild64
1 files changed, 42 insertions, 22 deletions
diff --git a/network/fail2ban/fail2ban.SlackBuild b/network/fail2ban/fail2ban.SlackBuild
index f5e29b948b..db6e648408 100644
--- a/network/fail2ban/fail2ban.SlackBuild
+++ b/network/fail2ban/fail2ban.SlackBuild
@@ -1,8 +1,9 @@
-#!/bin/sh
+#!/bin/bash
# Slackware Package Build Script for fail2ban
# Git Hub: https://github.com/fail2ban/fail2ban/
+# Copyright (c) 2024, Matteo Bernardini <ponce@slackbuilds.org>, Pisa, Italy
# Copyright (c) 2008-2018, Nishant Limbachia, Hoffman Estates, IL, USA
# <nishant _AT_ mnspace _DOT_ net>
# All rights reserved.
@@ -25,12 +26,15 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+
PRGNAM="fail2ban"
-VERSION=${VERSION:-0.10.4}
-BUILD=${BUILD:-1}
+VERSION=${VERSION:-1.0.2}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
-BASH_COMPLETION=${BASH_COMPLETION:-no}
+BASH_COMPLETION=${BASH_COMPLETION:-yes}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
@@ -40,7 +44,11 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
@@ -60,7 +68,11 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
-python setup.py install --root=$PKG
+sed -i 's|self.install_dir|"/usr/bin"|' setup.py
+sed -i 's/^before = paths-debian.conf/before = paths-slackware.conf/' config/jail.conf
+
+./fail2ban-2to3
+python3 setup.py install --root=$PKG
# installing man pages
mkdir -p $PKG/usr/man/{man1,man5}
@@ -68,15 +80,6 @@ install -m 0644 man/fail2ban-client.1 man/fail2ban-regex.1 \
man/fail2ban-server.1 man/fail2ban.1 man/fail2ban-testcases.1 $PKG/usr/man/man1
install -m 0644 man/jail.conf.5 $PKG/usr/man/man5
-# move config files to .new
-( cd $PKG/etc/fail2ban
- for file in $(find . -type f); do
- mv $file "$file.new"
- done
-)
-
-( cd $PKG/etc/fail2ban; patch -p0 < $CWD/patches/jail.conf.patch )
-
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
@@ -84,24 +87,31 @@ for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; r
install -D -m 0644 $CWD/rc.fail2ban $PKG/etc/rc.d/rc.fail2ban.new
# install slackware specific config file
-install -D -m 0644 $CWD/config/paths-slackware.conf $PKG/etc/fail2ban/paths-slackware.conf.new
+install -D -m 0644 $CWD/config/paths-slackware.conf $PKG/etc/fail2ban/paths-slackware.conf
# remove non-slackware specific config files
-rm -f $PKG/etc/fail2ban/paths-{arch,debian,fedora,freebsd,osx,opensuse}.conf.new
+rm -f $PKG/etc/fail2ban/paths-{arch,debian,fedora,freebsd,osx,opensuse}.conf
# install bash completion script if requested
if [ "$BASH_COMPLETION" = "yes" ]; then
- install -D -m 0644 files/bash-completion $PKG/etc/bash_completion.d/fail2ban.new
+ install -D -m 0644 files/bash-completion $PKG/usr/share/bash-completion/completions/fail2ban
+ ( cd $PKG/usr/share/bash-completion/completions ; ln -sf fail2ban fail2ban-client )
+ ( cd $PKG/usr/share/bash-completion/completions ; ln -sf fail2ban fail2ban-python )
+ ( cd $PKG/usr/share/bash-completion/completions ; ln -sf fail2ban fail2ban-regex )
+ ( cd $PKG/usr/share/bash-completion/completions ; ln -sf fail2ban fail2ban-server )
fi
# install logrotate script
install -D -m 0644 files/fail2ban-logrotate $PKG/etc/logrotate.d/fail2ban.new
-# make directory for socket, pid file & db file
-mkdir -p $PKG/var/{run,lib}/fail2ban
+# make directory for db file
+mkdir -p $PKG/var/lib/fail2ban
# remove /usr/share/doc
-rm -fr $PKG/usr/share
+rm -fr $PKG/usr/share/doc
+
+# remove the /run directory in the package
+rm -fr $PKG/run
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a CONTRIBUTING.md COPYING ChangeLog DEVELOP FILTERS MANIFEST \
@@ -114,5 +124,15 @@ mkdir -p $PKG/install
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
+# Don't clobber existing configuration files
+for i in etc/fail2ban/{,action.d,fail2ban.d,filter.d,jail.d}; do
+ for j in $(ls -1 $PKG/$i); do
+ if [ ! -d $PKG/$i/$j ]; then
+ mv $PKG/$i/$j $PKG/$i/$j.new
+ echo "config $i/$j.new" >> $PKG/install/doinst.sh
+ fi
+ done
+done
+
cd $PKG
-/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE