]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
test(GETARGS): set NEWROOT and PREFIX for dracut-lib.sh
authorBenjamin Drung <benjamin.drung@canonical.com>
Fri, 27 Jun 2025 13:47:52 +0000 (15:47 +0200)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Thu, 3 Jul 2025 13:35:31 +0000 (09:35 -0400)
Set `NEWROOT` to an existing directory to make sourcing `dracut-lib.sh`
work with `set -u`. Also set `PREFIX` to avoid creating `/run/initramfs`
which requires root permission.

test/TEST-80-GETARG/test.sh

index aed1cdf92b7a6bf003bfed288e0f70c96e21992e..0bc4709e99deac0486d41478413268783dce48b3 100755 (executable)
@@ -86,6 +86,10 @@ test_run() {
         [[ $val ]] && ret=$((ret + 1))
 
         export PATH=".:$PATH"
+        # shellcheck disable=SC2034  # NEWROOT defined for dracut-lib.sh, set by base/init.sh
+        NEWROOT=$(mktemp --directory -p "$TESTDIR" newroot.XXXXXXXXXX)
+        # shellcheck disable=SC2034  # PREFIX defined for dracut-lib.sh to avoid creating /run/initramfs
+        PREFIX=/nonexistent
 
         . dracut-dev-lib.sh
         . dracut-lib.sh