summaryrefslogtreecommitdiff
path: root/opt/nftables/MAKEPKG
blob: 2dc8d4eee358850db823f5e043c9711f05668366 (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
73
#!/bin/mkpkg
# description: Netfilter nftables - firewalling, NAT, and packet mangling for Linux (minimal)
# url: https://netfilter.org/projects/nftables/

# Note: This is a minimal build WITHOUT Python bindings

name=nftables
version=1.1.7
release=1
depends=(libmnl libnftnl libedit gmp)
makedeps=(bison flex)
groups=(nftables)
services=(nftables)
source=(
    https://www.netfilter.org/pub/nftables/nftables-$version.tar.xz
)
sha256sums=(
    "a6fbf060d8d4fff001517a2b94f356bb4366bfbf0ba366366f9d27cc38caa58f"
)

build() {
    cd $name-$version
    export CONFIG_SHELL=/bin/bash
    ./configure \
        --prefix=/usr \
        --sbindir=/usr/bin \
        --sysconfdir=/etc \
        --with-cli=editline \
        --without-json \
        --without-python-bin \
        --disable-debug \
        --disable-man-doc \
        --disable-python
    make
    make DESTDIR=$PKG install

    rm -rf $PKG/usr/share/doc
}

post_build() {
    # runit service
    install -d $PKG/etc/sv/nftables/log

    printf '%s\n' \
        '#!/bin/sh' \
        'exec 2>&1' \
        '[ ! -r /etc/nftables.conf ] && exit 0' \
        'nft -f /etc/nftables.conf' \
        'exec chpst -b nftables pause' \
        > $PKG/etc/sv/nftables/run

    printf '%s\n' \
        '#!/bin/sh' \
        'nft flush ruleset' \
        > $PKG/etc/sv/nftables/finish

    printf '%s\n' \
        '#!/bin/sh' \
        'mkdir -p /var/log/nftables' \
        'exec svlogd -tt /var/log/nftables' \
        > $PKG/etc/sv/nftables/log/run

    chmod 755 $PKG/etc/sv/nftables/run
    chmod 755 $PKG/etc/sv/nftables/finish
    chmod 755 $PKG/etc/sv/nftables/log/run
}

signify() {
    untrusted comment: public key
    RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3
}

# vim: filetype=sh