Debian Codegraph @

tests/shell/testcases/include/0014glob_directory_0

raw
1 #!/bin/bash
2
3 # Must not be confused in matched subdirectories.
4
5 set -e
6
7 tmpdir1=$(mktemp -d)
8 if [ ! -d $tmpdir1 ] ; then
9 echo "Failed to create tmp directory" >&2
10 exit 0
11 fi
12
13 tmpfile1=$(mktemp -p $tmpdir1)
14 if [ ! -w $tmpfile1 ] ; then
15 echo "Failed to create tmp file" >&2
16 exit 0
17 fi
18
19 tmpdir2=$(mktemp -p $tmpdir1 -d)
20 if [ ! -w $tmpdir2 ] ; then
21 echo "Failed to create the second tmp directory" >&2
22 exit 0
23 fi
24
25 tmpdir3=$(mktemp -p $tmpdir2 -d)
26 if [ ! -w $tmpdir3 ] ; then
27 echo "Failed to create the third tmp directory" >&2
28 exit 0
29 fi
30
31 # cleanup if aborted
32 trap "rm -rf $tmpfile1 && rmdir $tmpdir3 && rmdir $tmpdir2 && rmdir $tmpdir1" EXIT
33
34 RULESET1="include \"$tmpdir2/*\""
35
36 echo "$RULESET1" > $tmpfile1
37
38 $NFT -f $tmpfile1
39
40 if [ $? -ne 0 ] ; then
41 echo "E: tried to include a matched directory" >&2
42 exit 1
43 fi