Better examples

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
2026-11-27 16:14:30 +00:00
parent fd658f7545
commit f74df5962e
11 changed files with 152 additions and 25 deletions
+22 -7
View File
@@ -1,11 +1,26 @@
#!/usr/bin/env ssm
service_oneshot = true
service_command = /usr/bin/false
# nftables ruleset.
#
# There is no nftables daemon: the ruleset is applied at startup and
# stays in the kernel until changed. We therefore treat this as a oneshot
# service whose real job is to apply the ruleset.
service::pre_start() {
cat <<- EOF
Please don't. Use ferm or any other wrapper.
You will just reinvent one in here anyway.
EOF
service_oneshot = yes
service_command = /usr/sbin/nft -f /etc/nftables.conf
var nftables_conf = /etc/nftables.conf
check_config() {
[[ ! -f "$nftables_conf" ]] && err "nftables config not found: $nftables_conf"
}
pre_start() {
check_config || return 17
}
reload() {
check_config || return 17
/usr/sbin/nft -f "$nftables_conf"
}