blob: 4d43e27cb2eb1074eca210c98533cf6578d1b3d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#!/bin/mkpkg
# description: Daemon to ban hosts that cause multiple authentication errors
# url: https://www.fail2ban.org/
name=fail2ban
version=1.1.1
release=1
depends=(python3)
makedeps=(py-setuptools)
source=(https://github.com/fail2ban/fail2ban/archive/$version.tar.gz)
sha256sums=(
"4be0ea0488e32de260058462a44a040f0542cd26a9fb6fa6d2514f9dd8ec1609"
)
build() {
cd $name-$version
/usr/bin/python3 setup.py build
/usr/bin/python3 setup.py install --root="$PKG" --skip-build
# fail2ban's setup.py installs config trees under prefix/etc.
# Relocate them to /etc if they landed in /usr/etc.
if [ -d "$PKG/usr/etc" ]; then
install -dm755 "$PKG/etc"
cp -a "$PKG/usr/etc/." "$PKG/etc/"
rm -rf "$PKG/usr/etc"
fi
# Drop systemd bits (krypt/sh uses runit)
rm -rf "$PKG/usr/lib/systemd" "$PKG/lib/systemd" 2>/dev/null || true
rm -rf "$PKG/etc/fail2ban/fail2ban.service.d" 2>/dev/null || true
# Bytecode-compile Python sources
_pyver=$(/usr/bin/python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
_sitedir="$PKG/usr/lib/python${_pyver}/site-packages"
if [ -d "$_sitedir" ]; then
/usr/bin/python3 -OO -m compileall -b -q "$_sitedir"
find "$_sitedir" -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
fi
# Strip dev-only bits: test runner binary and tests tree
rm -f "$PKG/usr/bin/fail2ban-testcases" || true
rm -rf "$_sitedir/fail2ban/tests" || true
# Runit service: /etc/sv/fail2ban/run
install -dm755 "$PKG/etc/sv/fail2ban"
printf '%s\n' \
'#!/bin/sh' \
'exec 2>&1' \
'exec /usr/bin/fail2ban-server -f -x start' \
> "$PKG/etc/sv/fail2ban/run"
chmod 755 "$PKG/etc/sv/fail2ban/run"
# Runit log service: /etc/sv/fail2ban/log/run
install -dm755 "$PKG/etc/sv/fail2ban/log"
printf '%s\n' \
'#!/bin/sh' \
'exec svlogd -tt /var/log/fail2ban' \
> "$PKG/etc/sv/fail2ban/log/run"
chmod 755 "$PKG/etc/sv/fail2ban/log/run"
# Pre-create log directory
install -dm755 "$PKG/var/log/fail2ban"
}
signify() {
untrusted comment: public key
RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3
}
# vim: filetype=sh
|