]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/shell: fix "0003includepath_0" for different TMPDIR
authorThomas Haller <thaller@redhat.com>
Wed, 6 Sep 2023 11:52:21 +0000 (13:52 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 7 Sep 2023 17:35:21 +0000 (19:35 +0200)
We are going to set $TMPDIR to another location. The previous code made
assumptions that the generated path would always be in /tmp. Fix that.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
tests/shell/testcases/include/0003includepath_0

index ba722068b363a5db76f39b6cad3432e89ac0a4bd..20037a8f02794b2864d9a6413b38d8522e0a88c8 100755 (executable)
@@ -8,7 +8,7 @@ if [ ! -w $tmpfile1 ] ; then
         exit 0
 fi
 
-tmpfile3=$(echo "$tmpfile1" | cut -d'/' -f 3)
+tmpfile3="$(basename "$tmpfile1")"
 
 tmpfile2=$(mktemp)
 if [ ! -w $tmpfile2 ] ; then
@@ -24,7 +24,7 @@ RULESET2="include \"$tmpfile3\""
 echo "$RULESET1" > $tmpfile1
 echo "$RULESET2" > $tmpfile2
 
-$NFT -I /tmp -f $tmpfile2
+$NFT -I "$(dirname "$tmpfile1")" -f $tmpfile2
 if [ $? -ne 0 ] ; then
        echo "E: unable to load good ruleset" >&2
        exit 1