adjust nftables scripts to fit what alpine does

This commit is contained in:
Nico Schottelius 2019-09-29 15:26:21 +02:00
parent 2c614aecc8
commit bfdb0c4daa
2 changed files with 21 additions and 3 deletions

View file

@ -14,7 +14,7 @@
CONF=/etc/nftables.conf CONF=/etc/nftables.nft
BIN=/usr/sbin/nft BIN=/usr/sbin/nft
[ -x "$BIN" ] || exit 0 [ -x "$BIN" ] || exit 0

View file

@ -1,5 +1,9 @@
initscript="$__type/files/nftables-init" initscript="$__type/files/nftables-init"
os=$(cat $__global/explorer/os)
conf=/etc/firewall.nft
if [ -f "$__object/parameter/config-from-stdin" ]; then if [ -f "$__object/parameter/config-from-stdin" ]; then
srcfile="$__object/stdin" srcfile="$__object/stdin"
else else
@ -20,6 +24,20 @@ fi
__package nftables __package nftables
__file /etc/nftables.conf --source "$srcfile" --mode 0644 __file /etc/nftables.conf --source "$srcfile" --mode 0644
__file /etc/init.d/nftables --source "$initscript" --mode 0755
require="__file/etc/init.d/nftables" __start_on_boot nftables case $os in
# Alpine actually has an init script, as opposed to everyone else
alpine)
:
;;
debian|devuan)
__file /etc/init.d/nftables --source "$initscript" --mode 0755
;;
*)
echo "Unsupported os: $os" >&2
exit 1
;;
esac
require="__package/nftables" __start_on_boot nftables