Debian Codegraph @

tests/shell/testcases/include/0011glob_dependency_0

raw
1 #!/bin/bash
2
3 # Files are included in alphabetical order.
4
5 set -e
6
7 tmpdir=$(mktemp -d)
8 if [ ! -d $tmpdir ] ; then
9 echo "Failed to create tmp directory" >&2
10 exit 0
11 fi
12
13 tmpfile1="$tmpdir/01_file.nft"
14 touch $tmpfile1
15 if [ ! -w $tmpfile1 ] ; then
16 echo "Failed to create tmp file" >&2
17 exit 0
18 fi
19
20 tmpfile2="$tmpdir/02_file.nft"
21 touch $tmpfile2
22 if [ ! -w $tmpfile2 ] ; then
23 echo "Failed to create tmp file" >&2
24 exit 0
25 fi
26
27 tmpfile3=$(mktemp)
28 if [ ! -w $tmpfile3 ] ; then
29 echo "Failed to create tmp file" >&2
30 exit 0
31 fi
32
33 # cleanup if aborted
34 trap "rm -rf $tmpfile1 $tmpfile2 $tmpfile3 && rmdir $tmpdir" EXIT
35
36 # add interdependent rulesets
37 RULESET1="add table x"
38 RULESET2="add chain x y"
39 RULESET3="include \"$tmpdir/*\""
40
41 echo "$RULESET1" > $tmpfile1
42 echo "$RULESET2" > $tmpfile2
43 echo "$RULESET3" > $tmpfile3
44
45 $NFT -f $tmpfile3
46
47 if [ $? -ne 0 ] ; then
48 echo "E: unable to load good ruleset" >&2
49 exit 1
50 fi