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.SlackBuild42
1 files changed, 24 insertions, 18 deletions
diff --git a/network/fail2ban/fail2ban.SlackBuild b/network/fail2ban/fail2ban.SlackBuild
index d8447e754d..a08000e8f7 100644
--- a/network/fail2ban/fail2ban.SlackBuild
+++ b/network/fail2ban/fail2ban.SlackBuild
@@ -3,6 +3,7 @@
# 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.
@@ -28,12 +29,12 @@
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM="fail2ban"
-VERSION=${VERSION:-0.10.4}
+VERSION=${VERSION:-1.0.2}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
-BASH_COMPLETION=${BASH_COMPLETION:-no}
+BASH_COMPLETION=${BASH_COMPLETION:-yes}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
@@ -43,9 +44,6 @@ if [ -z "$ARCH" ]; then
esac
fi
-# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
-# the name of the created package would be, and then exit. This information
-# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
@@ -70,6 +68,10 @@ 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 {} \;
+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
python setup.py install --root=$PKG
# installing man pages
@@ -78,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
@@ -101,17 +94,20 @@ rm -f $PKG/etc/fail2ban/paths-{arch,debian,fedora,freebsd,osx,opensuse}.conf.new
# 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
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 \
@@ -124,5 +120,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