Allow config from stdin

This commit is contained in:
Nico Schottelius 2018-07-08 21:02:03 +02:00
parent 34cb6b6ad2
commit cc3118d2e8
3 changed files with 17 additions and 5 deletions

View File

@ -1,11 +1,22 @@
config=$(cat "$__object/parameter/config")
srcfile="$__files/nftables/${config}.conf"
initscript="$__type/files/nftables-init"
if [ ! -f "$srcfile" ]; then
echo "No such config ${config}. Aborting." >&2
exit 1
if [ -f "$__object/parameter/config-from_stdin" ]; then
srcfile="$__object/stdin"
else
if [ ! -f "$__object/parameter/config" ]; then
echo "Need either config-from-stdin or config" >&2
exit 1
fi
srcfile="$__files/nftables/${config}.conf"
if [ ! -f "$srcfile" ]; then
echo "No such config ${config}. Aborting." >&2
exit 1
fi
fi
__package nftables

2
parameter/optional Normal file
View File

@ -0,0 +1,2 @@
config
config-from-stdin

View File

@ -1 +0,0 @@
config