abuild: add default_nftrules helper

As proposed here:

https://gitlab.alpinelinux.org/alpine/aports/-/issues/16177
This commit is contained in:
Willow Barraco 2024-06-03 15:11:06 +02:00 committed by Natanael Copa
parent 15b9496135
commit ca9bc0a9e9
1 changed files with 13 additions and 0 deletions

View File

@ -2173,6 +2173,19 @@ pyc() {
default_pyc
}
default_nftrules() {
pkgdesc="$pkgdesc (nftables ruleset)"
install_if="nftables-rulesets ${subpkgname%-nftrules}=$pkgver-r$pkgrel"
if [ -d "$pkgdir"/etc/nftables.d ]; then
amove 'etc/nftables.d/*.nft'
fi
}
nftrules() {
default_nftrules
}
is_function() {
type "$1" 2>&1 | head -n 1 | grep -E -q "is a (shell )?function"
}