From bfdb0c4daacfa95e24450e5ce79c98e4acd996ec Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 29 Sep 2019 15:26:21 +0200 Subject: [PATCH] adjust nftables scripts to fit what alpine does --- files/nftables-init | 2 +- manifest | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/files/nftables-init b/files/nftables-init index b9c1e86..6e9b5e3 100755 --- a/files/nftables-init +++ b/files/nftables-init @@ -14,7 +14,7 @@ -CONF=/etc/nftables.conf +CONF=/etc/nftables.nft BIN=/usr/sbin/nft [ -x "$BIN" ] || exit 0 diff --git a/manifest b/manifest index af24e6a..ac8266e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,9 @@ initscript="$__type/files/nftables-init" +os=$(cat $__global/explorer/os) + +conf=/etc/firewall.nft + if [ -f "$__object/parameter/config-from-stdin" ]; then srcfile="$__object/stdin" else @@ -20,6 +24,20 @@ fi __package nftables __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