jobextra/fail2ban/PKGBUILD
2023-05-22 03:48:31 +03:00

80 lines
2.6 KiB
Bash

#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgname=fail2ban
pkgver=1.0.2
pkgrel=04
pkgdesc='Bans IPs after too many failed authentication attempts'
url='https://www.fail2ban.org/'
depends=('python-pyinotify' 'whois' 'sqlite')
makedepends=('python-setuptools')
optdepends=(
'firewalld: for a firewall backend'
'ipset: for a firewall backend'
'iptables: for a firewall backend'
'nftables: for a firewall backend'
)
checkdepends=('python-coverage')
backup=(etc/fail2ban/fail2ban.conf
etc/fail2ban/jail.conf
etc/logrotate.d/fail2ban)
source=("$pkgname-$pkgver.tar.gz::https://github.com/fail2ban/$pkgname/archive/$pkgver.tar.gz")
# "$pkgname-dovecot-regex.patch::https://github.com/fail2ban/fail2ban/commit/ca2b94c5229b.patch")
prepare() {
cd $pkgname-$pkgver
sed -i 's|self.install_dir|"/usr/bin"|' setup.py
sed -i 's/^before = paths-debian.conf/before = paths-arch.conf/' config/jail.conf
# # https://github.com/fail2ban/fail2ban/issues/3370
# patch -Np1 -i ../$pkgname-dovecot-regex.patch || [[ $pkgver == 1.0.1 ]]
}
build() {
cd $pkgname-$pkgver
./fail2ban-2to3
python setup.py build
}
package() {
cd $pkgname-$pkgver
python setup.py install --root "$pkgdir" --optimize=1
# install -Dm644 build/fail2ban.service \
# "$pkgdir"/usr/lib/systemd/system/$pkgname.service
install -Dm644 files/fail2ban-tmpfiles.conf \
"$pkgdir"/usr/lib/tmpfiles.d/$pkgname.conf
install -Dm644 files/fail2ban-logrotate \
"$pkgdir"/etc/logrotate.d/fail2ban
install -Dm644 files/bash-completion \
"$pkgdir"/usr/share/bash-completion/completions/fail2ban
# fix sendmail location
sed -i 's/sbin/bin/g' "$pkgdir"/etc/fail2ban/action.d/sendmail*.conf
install -Dm644 man/fail2ban.1 "$pkgdir"/usr/share/man/man1/fail2ban.1
install -Dm644 man/fail2ban-client.1 \
"$pkgdir"/usr/share/man/man1/fail2ban-client.1
install -Dm644 man/fail2ban-regex.1 \
"$pkgdir"/usr/share/man/man1/fail2ban-regex.1
install -Dm644 man/fail2ban-server.1 \
"$pkgdir"/usr/share/man/man1/fail2ban-server.1
install -Dm644 man/jail.conf.5 "$pkgdir"/usr/share/man/man5/jail.conf.5
rm -r "$pkgdir/run"
}
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
license=('GPL')
sha256sums=(ae8b0b41f27a7be12d40488789d6c258029b23a01168e3c0d347ee80b325ac23) # fail2ban-1.0.2.tar.gz
## eac9b3223cce7a4dd02db8ee4a66a0ff74cee7d055868c8fa9383eb39c25804b fail2ban-1.0.2-04-x86_64.pkg.tar.lz