File: 0002relative_0

package info (click to toggle)
nftables 1.1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,384 kB
  • sloc: ansic: 50,901; sh: 20,277; yacc: 5,861; python: 1,746; lex: 1,367; makefile: 392
file content (30 lines) | stat: -rwxr-xr-x 481 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

tmpfile1=$(mktemp -p .)
if [ ! -w "$tmpfile1" ] ; then
	# cwd might be readonly, mark as skip.
	echo "Failed to create tmp file" >&2
	exit 77
fi

cleanup()
{
	rm -f "$tmpfile1" "$tmpfile2"
}

trap cleanup EXIT

set -e
tmpfile2=$(mktemp -p .)

RULESET1="add table x"
RULESET2="include \"$tmpfile1\""

echo "$RULESET1" > $tmpfile1
echo "$RULESET2" > $tmpfile2

$NFT -f $tmpfile2
if [ $? -ne 0 ] ; then
        echo "E: unable to load good ruleset" >&2
        exit 1
fi