#!/bin/sh # Slackware Package Build Script for fail2ban # Home Page http://www.fail2ban.org/wiki/index.php/Main_Page # Git Hub: https://github.com/fail2ban/fail2ban/ # Copyright (c) 2008-2011, Nishant Limbachia, Hoffman Estates, IL, USA # # 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 script must retain the above copyright notice, # this list of conditions and the following disclaimer. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "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 COPYRIGHT OWNER OR # CONTRIBUTORS 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. # default settings PACKAGE="fail2ban" PACKAGE_EXT="gz" VERSION=${VERSION:=0.11.2} BUILD=${BUILD:=5} if [ -f ~/.slackbuildrc ]; then . ~/.slackbuildrc elif [ -f ../../runtime/slackbuildrc ]; then . ../../runtime/slackbuildrc fi check_required SRC="${VERSION}.tar.$PACKAGE_EXT" URL="https://github.com/fail2ban/fail2ban/archive/refs/tags/$SRC" get_source $SRC $URL unpack_source $SRC fail2ban-${VERSION} # Upstream patch for python >- 3.10 cat $CWD/git-update.patch | patch -p1 #find -type f -exec sed -i -e '1s,^#!/usr/bin/python *,#!/usr/bin/python%{python3_version},' {} + # Replace /var/run with /run, but not in the top source directory find . -mindepth 2 -type f -exec sed -i -e 's|/var\(/run/fail2ban\)|\1|g' {} + || die echo "** To Python3 **" 2to3 --write --no-diffs . echo "** Install fail2ban **" python3 -m pip install --no-warn-script-location --use-feature=in-tree-build \ . --root=$PKG echo "** Install finished **" # installing man pages mkdir -p $PKG/usr/man/man1 $PKG/usr/man/man5 install -m 0644 man/fail2ban-client.1 man/fail2ban-regex.1 man/fail2ban-server.1 man/fail2ban.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 $(ls *.conf); do mv $file "$file.new" done ) # install startup script install -D -m 0644 $CWD/rc.fail2ban $PKG/etc/rc.d/rc.fail2ban.new # install logrotate script install -D -m 0644 $CWD/fail2ban.logrotate $PKG/etc/logrotate.d/fail2ban.new # Duplicated docs rm -rf $PKG/usr/share $PKG/run mkdir -p $DOCS cp -a CONTRIBUTING.md COPYING ChangeLog DEVELOP FILTERS README* THANKS TODO $DOCS fixup_package $PKG # Clean up the extra stuff: set +u if [ "$1" = "--cleanup" ]; then rm -rf $TMP/$PACKAGE-$VERSION rm -rf $PKG fi