]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(TEST NBD): shellcheck
authorHarald Hoyer <harald@redhat.com>
Tue, 30 Mar 2021 10:19:52 +0000 (12:19 +0200)
committerHarald Hoyer <harald@hoyer.xyz>
Tue, 30 Mar 2021 13:53:47 +0000 (15:53 +0200)
test/TEST-40-NBD/.shchkdir [new file with mode: 0644]
test/TEST-40-NBD/client-init.sh
test/TEST-40-NBD/create-client-root.sh
test/TEST-40-NBD/create-encrypted-root.sh
test/TEST-40-NBD/create-server-root.sh
test/TEST-40-NBD/cryptroot-ask.sh
test/TEST-40-NBD/server-init.sh
test/TEST-40-NBD/test.sh

diff --git a/test/TEST-40-NBD/.shchkdir b/test/TEST-40-NBD/.shchkdir
new file mode 100644 (file)
index 0000000..e69de29
index 0a0f6c1cf69246b1072737dc51d1fc8bebe8ac9b..5adb66f23f0aae5dea17c66b36344b300ee00b7a 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/sh
-> /dev/watchdog
+> /dev/watchdog
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 exec > /dev/console 2>&1
-while read dev fs fstype opts rest || [ -n "$dev" ]; do
+while read -r dev fs fstype opts rest || [ -n "$dev" ]; do
     [ "$dev" = "rootfs" ] && continue
     [ "$fs" != "/" ] && continue
     echo "nbd-OK $fstype $opts" | dd oflag=direct,dsync of=/dev/sda
@@ -14,7 +14,7 @@ export PS1='nbdclient-test:\w\$ '
 stty sane
 echo "made it to the rootfs! Powering down."
 #sh -i
-> /dev/watchdog
+> /dev/watchdog
 mount -n -o remount,ro / &> /dev/null
-> /dev/watchdog
+> /dev/watchdog
 poweroff -f
index 69b51ee8f565b5de95e54b6dddb5cc2b377f44ce..535e046b750183b0a1a6a9164a57de8515b55026 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # don't let udev and this script step on eachother's toes
 for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
-    > "/etc/udev/rules.d/$x"
+    > "/etc/udev/rules.d/$x"
 done
 rm -f -- /etc/lvm/lvm.conf
 udevadm control --reload
index f605c0e4b36a71f6e6ed11ab638bc34689cc9cfd..bbd48b8ecb71139f79fab88a6478e47a99c0f789 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # don't let udev and this script step on eachother's toes
 for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
-    > "/etc/udev/rules.d/$x"
+    > "/etc/udev/rules.d/$x"
 done
 rm -f -- /etc/lvm/lvm.conf
 udevadm control --reload
@@ -26,7 +26,7 @@ udevadm settle
 cryptsetup luksClose /dev/mapper/dracut_crypt_test
 udevadm settle
 sleep 1
-eval $(udevadm info --query=env --name=/dev/sda | while read line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo $line; done)
+eval "$(udevadm info --query=env --name=/dev/sda | while read -r line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo "$line"; done)"
 {
     echo "dracut-root-block-created"
     echo "ID_FS_UUID=$ID_FS_UUID"
index 69b51ee8f565b5de95e54b6dddb5cc2b377f44ce..535e046b750183b0a1a6a9164a57de8515b55026 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # don't let udev and this script step on eachother's toes
 for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
-    > "/etc/udev/rules.d/$x"
+    > "/etc/udev/rules.d/$x"
 done
 rm -f -- /etc/lvm/lvm.conf
 udevadm control --reload
index 7318fa7068f90c5957f13e7975f0dbd5b8ca9d86..a6b7ac70f39add750dd78e6f95c6f042e2283ea7 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
 
-[ -b /dev/mapper/$2 ] && exit 0
+[ -b /dev/mapper/"$2" ] && exit 0
 printf test > /keyfile
-/sbin/cryptsetup luksOpen $1 $2 < /keyfile
+/sbin/cryptsetup luksOpen "$1" "$2" < /keyfile
index eb7e9942d05399bc9a6eaa93c8b8c7a756873b99..e22c649662f4c36f8242f24ef221c92c6768cbfb 100755 (executable)
@@ -12,10 +12,10 @@ wait_for_if_link() {
     local cnt=0
     local li
     while [ $cnt -lt 600 ]; do
-        li=$(ip -o link show dev $1 2> /dev/null)
+        li=$(ip -o link show dev "$1" 2> /dev/null)
         [ -n "$li" ] && return 0
         if [[ $2 ]]; then
-            li=$(ip -o link show dev $2 2> /dev/null)
+            li=$(ip -o link show dev "$2" 2> /dev/null)
             [ -n "$li" ] && return 0
         fi
         sleep 0.1
@@ -28,7 +28,7 @@ wait_for_if_up() {
     local cnt=0
     local li
     while [ $cnt -lt 200 ]; do
-        li=$(ip -o link show up dev $1)
+        li=$(ip -o link show up dev "$1")
         [ -n "$li" ] && return 0
         sleep 0.1
         cnt=$((cnt + 1))
@@ -48,7 +48,7 @@ wait_for_route_ok() {
 }
 
 linkup() {
-    wait_for_if_link $1 2> /dev/null && ip link set $1 up 2> /dev/null && wait_for_if_up $1 2> /dev/null
+    wait_for_if_link "$1" 2> /dev/null && ip link set "$1" up 2> /dev/null && wait_for_if_up "$1" 2> /dev/null
 }
 
 wait_for_if_link eth0 ens3
@@ -61,7 +61,7 @@ linkup ens3
 
 modprobe af_packet
 nbd-server
-> /var/lib/dhcpd/dhcpd.leases
+> /var/lib/dhcpd/dhcpd.leases
 chmod 777 /var/lib/dhcpd/dhcpd.leases
 dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &
 echo "Serving NBD disks"
index b9abd2d01645c7f08921d14139d3a8afe209ae6f..e9063c2e0f7466f844ad9d65dea63c551bc35f77 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/bash
 
+# shellcheck disable=SC2034
 TEST_DESCRIPTION="root filesystem on NBD"
 
 KVERSION=${KVERSION-$(uname -r)}
@@ -17,7 +18,7 @@ test_check() {
         return 1
     fi
 
-    if ! modinfo -k $KVERSION nbd &> /dev/null; then
+    if ! modinfo -k "$KVERSION" nbd &> /dev/null; then
         echo "Kernel module nbd does not exist"
         return 1
     fi
@@ -29,17 +30,16 @@ run_server() {
     # Start server first
     echo "NBD TEST SETUP: Starting DHCP/NBD server"
 
-    $testdir/run-qemu \
-        -drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext3 \
-        -drive format=raw,index=1,media=disk,file=$TESTDIR/nbd.ext3 \
-        -drive format=raw,index=2,media=disk,file=$TESTDIR/encrypted.ext3 \
+    "$testdir"/run-qemu \
+        -drive format=raw,index=0,media=disk,file="$TESTDIR"/server.ext3 \
+        -drive format=raw,index=1,media=disk,file="$TESTDIR"/nbd.ext3 \
+        -drive format=raw,index=2,media=disk,file="$TESTDIR"/encrypted.ext3 \
         -net nic,macaddr=52:54:00:12:34:56,model=e1000 \
         -net socket,listen=127.0.0.1:12340 \
-        ${SERIAL:+-serial "$SERIAL"} \
-        ${SERIAL:--serial file:"$TESTDIR"/server.log} \
+        -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \
         -append "panic=1 systemd.crash_reboot root=/dev/sda rootfstype=ext3 rw quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.server -pidfile $TESTDIR/server.pid -daemonize || return 1
-    chmod 644 $TESTDIR/server.pid || return 1
+        -initrd "$TESTDIR"/initramfs.server -pidfile "$TESTDIR"/server.pid -daemonize || return 1
+    chmod 644 "$TESTDIR"/server.pid || return 1
 
     # Cleanup the terminal if we have one
     tty -s && stty sane
@@ -71,25 +71,26 @@ client_test() {
     echo "CLIENT TEST START: $test_name"
 
     # Clear out the flags for each test
-    if ! dd if=/dev/zero of=$TESTDIR/flag.img bs=1M count=1; then
+    if ! dd if=/dev/zero of="$TESTDIR"/flag.img bs=1M count=1; then
         echo "Unable to make client flag image" 1>&2
         return 1
     fi
 
-    $testdir/run-qemu \
-        -drive format=raw,index=0,media=disk,file=$TESTDIR/flag.img \
-        -net nic,macaddr=$mac,model=e1000 \
+    "$testdir"/run-qemu \
+        -drive format=raw,index=0,media=disk,file="$TESTDIR"/flag.img \
+        -net nic,macaddr="$mac",model=e1000 \
         -net socket,connect=127.0.0.1:12340 \
         -append "panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.auto rd.info rd.retry=10 ro console=ttyS0,115200n81  selinux=0  " \
-        -initrd $TESTDIR/initramfs.testing
+        -initrd "$TESTDIR"/initramfs.testing
 
-    if [[ $? -ne 0 ]] || ! grep -U --binary-files=binary -F -m 1 -q nbd-OK $TESTDIR/flag.img; then
+    # shellcheck disable=SC2181
+    if [[ $? -ne 0 ]] || ! grep -U --binary-files=binary -F -m 1 -q nbd-OK "$TESTDIR"/flag.img; then
         echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
         return 1
     fi
 
     # nbdinfo=( fstype fsoptions )
-    nbdinfo=($(awk '{print $2, $3; exit}' $TESTDIR/flag.img))
+    read -a -r nbdinfo < <(awk '{print $2, $3; exit}' "$TESTDIR"/flag.img)
 
     if [[ ${nbdinfo[0]} != "$fstype" ]]; then
         echo "CLIENT TEST END: $test_name [FAILED - WRONG FS TYPE] \"${nbdinfo[0]}\" != \"$fstype\""
@@ -98,7 +99,7 @@ client_test() {
 
     opts=${nbdinfo[1]},
     while [[ $opts ]]; do
-        if [[ ${opts%%,*} == $fsopt ]]; then
+        if [[ ${opts%%,*} == "$fsopt" ]]; then
             found=1
             break
         fi
@@ -181,7 +182,8 @@ client_run() {
 
     # Encrypted root handling via LVM/LUKS over NBD
 
-    . $TESTDIR/luks.uuid
+    # shellcheck disable=SC1090
+    . "$TESTDIR"/luks.uuid
 
     client_test "NBD root=LABEL=dracut netroot=nbd:IP:port" \
         52:54:00:12:34:00 \
@@ -195,26 +197,28 @@ client_run() {
     #                "root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut netroot=dhcp" || return 1
 
     if [[ -s server.pid ]]; then
-        kill -TERM $(cat $TESTDIR/server.pid)
-        rm -f -- $TESTDIR/server.pid
+        kill -TERM "$(cat "$TESTDIR"/server.pid)"
+        rm -f -- "$TESTDIR"/server.pid
     fi
 
 }
 
 make_encrypted_root() {
     # Create the blank file to use as a root filesystem
-    dd if=/dev/zero of=$TESTDIR/encrypted.ext3 bs=1M count=80
-    dd if=/dev/zero of=$TESTDIR/flag.img bs=1M count=1
+    dd if=/dev/zero of="$TESTDIR"/encrypted.ext3 bs=1M count=80
+    dd if=/dev/zero of="$TESTDIR"/flag.img bs=1M count=1
 
     rm -fr "$TESTDIR"/overlay
     kernel=$KVERSION
     # Create what will eventually be our root filesystem onto an overlay
     (
+        # shellcheck disable=SC2030
         export initdir=$TESTDIR/overlay/source
-        . $basedir/dracut-init.sh
+        # shellcheck disable=SC1090
+        . "$basedir"/dracut-init.sh
         mkdir -p "$initdir"
         (
-            cd "$initdir"
+            cd "$initdir" || exit
             mkdir -p -- dev sys proc etc var/run tmp
             mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
             for i in bin sbin lib lib64; do
@@ -231,16 +235,19 @@ make_encrypted_root() {
         inst ./client-init.sh /sbin/init
         inst_simple /etc/os-release
         find_binary plymouth > /dev/null && inst_multiple plymouth
-        cp -a /etc/ld.so.conf* $initdir/etc
+        cp -a /etc/ld.so.conf* "$initdir"/etc
         ldconfig -r "$initdir"
     )
 
     # second, install the files needed to make the root filesystem
     (
+        # shellcheck disable=SC2030
+        # shellcheck disable=SC2031
         export initdir=$TESTDIR/overlay
-        . $basedir/dracut-init.sh
+        # shellcheck disable=SC1090
+        . "$basedir"/dracut-init.sh
         (
-            cd "$initdir"
+            cd "$initdir" || exit
             mkdir -p dev sys proc etc tmp var run root usr/bin usr/lib usr/lib64 usr/sbin
             for i in bin sbin lib lib64; do
                 ln -sfnr usr/$i $i
@@ -258,36 +265,39 @@ make_encrypted_root() {
     # create an initramfs that will create the target root filesystem.
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
-    $basedir/dracut.sh -l -i $TESTDIR/overlay / \
+    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
         -m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
         -d "piix ide-gd_mod ata_piix ext3 ext3 sd_mod" \
         --no-hostonly-cmdline -N \
-        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
-    rm -rf -- $TESTDIR/overlay
+        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
+    rm -rf -- "$TESTDIR"/overlay
 
     # Invoke KVM and/or QEMU to actually create the target filesystem.
-    $testdir/run-qemu \
-        -drive format=raw,index=0,media=disk,file=$TESTDIR/encrypted.ext3 \
-        -drive format=raw,index=1,media=disk,file=$TESTDIR/flag.img \
+    "$testdir"/run-qemu \
+        -drive format=raw,index=0,media=disk,file="$TESTDIR"/encrypted.ext3 \
+        -drive format=raw,index=1,media=disk,file="$TESTDIR"/flag.img \
         -append "root=/dev/fakeroot rw quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot || return 1
-    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/flag.img || return 1
-    grep -F -a -m 1 ID_FS_UUID $TESTDIR/flag.img > $TESTDIR/luks.uuid
+        -initrd "$TESTDIR"/initramfs.makeroot || return 1
+    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/flag.img || return 1
+    grep -F -a -m 1 ID_FS_UUID "$TESTDIR"/flag.img > "$TESTDIR"/luks.uuid
 }
 
 make_client_root() {
-    dd if=/dev/zero of=$TESTDIR/nbd.ext3 bs=1M count=120
-    dd if=/dev/zero of=$TESTDIR/flag.img bs=1M count=1
+    dd if=/dev/zero of="$TESTDIR"/nbd.ext3 bs=1M count=120
+    dd if=/dev/zero of="$TESTDIR"/flag.img bs=1M count=1
 
     rm -fr "$TESTDIR"/overlay
     kernel=$KVERSION
     (
-        mkdir -p $TESTDIR/overlay/source
+        mkdir -p "$TESTDIR"/overlay/source
+        # shellcheck disable=SC2030
+        # shellcheck disable=SC2031
         export initdir=$TESTDIR/overlay/source
+        # shellcheck disable=SC1090
         . "$basedir"/dracut-init.sh
         mkdir -p "$initdir"
         (
-            cd "$initdir"
+            cd "$initdir" || exit
             mkdir -p -- dev sys proc etc var/run tmp
             mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
             for i in bin sbin lib lib64; do
@@ -307,16 +317,19 @@ make_client_root() {
         inst /etc/group /etc/group
         for i in /usr/lib*/libnss_files* /lib*/libnss_files*; do
             [ -e "$i" ] || continue
-            inst $i
+            inst "$i"
         done
-        cp -a /etc/ld.so.conf* $initdir/etc
+        cp -a /etc/ld.so.conf* "$initdir"/etc
         ldconfig -r "$initdir"
     )
 
     # second, install the files needed to make the root filesystem
     (
+        # shellcheck disable=SC2030
+        # shellcheck disable=SC2031
         export initdir=$TESTDIR/overlay
-        . $basedir/dracut-init.sh
+        # shellcheck disable=SC1090
+        . "$basedir"/dracut-init.sh
         inst_multiple sfdisk mkfs.ext3 poweroff cp umount sync dd
         inst_hook initqueue 01 ./create-client-root.sh
         inst_hook initqueue/finished 01 ./finished-false.sh
@@ -326,36 +339,39 @@ make_client_root() {
     # create an initramfs that will create the target root filesystem.
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
-    $basedir/dracut.sh -l -i $TESTDIR/overlay / \
+    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
         -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
         -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
         --nomdadmconf \
         --no-hostonly-cmdline -N \
-        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
 
     # Invoke KVM and/or QEMU to actually create the target filesystem.
-    $testdir/run-qemu \
-        -drive format=raw,index=0,media=disk,file=$TESTDIR/nbd.ext3 \
-        -drive format=raw,index=1,media=disk,file=$TESTDIR/flag.img \
+    "$testdir"/run-qemu \
+        -drive format=raw,index=0,media=disk,file="$TESTDIR"/nbd.ext3 \
+        -drive format=raw,index=1,media=disk,file="$TESTDIR"/flag.img \
         -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot || return 1
-    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/flag.img || return 1
+        -initrd "$TESTDIR"/initramfs.makeroot || return 1
+    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/flag.img || return 1
     rm -fr "$TESTDIR"/overlay
 }
 
 make_server_root() {
-    dd if=/dev/zero of=$TESTDIR/server.ext3 bs=1M count=120
-    dd if=/dev/zero of=$TESTDIR/flag.img bs=1M count=1
+    dd if=/dev/zero of="$TESTDIR"/server.ext3 bs=1M count=120
+    dd if=/dev/zero of="$TESTDIR"/flag.img bs=1M count=1
 
-    rm -fr $TESTDIR/overlay
+    rm -fr "$TESTDIR"/overlay
     kernel=$KVERSION
     (
-        mkdir -p $TESTDIR/overlay/source
+        mkdir -p "$TESTDIR"/overlay/source
+        # shellcheck disable=SC2030
+        # shellcheck disable=SC2031
         export initdir=$TESTDIR/overlay/source
+        # shellcheck disable=SC1090
         . "$basedir"/dracut-init.sh
         mkdir -p "$initdir"
         (
-            cd "$initdir"
+            cd "$initdir" || exit
             mkdir -p run dev sys proc etc var var/lib/dhcpd tmp etc/nbd-server
             ln -s ../run var/run
         )
@@ -389,17 +405,20 @@ EOF
         inst /etc/group /etc/group
         for i in /usr/lib*/libnss_files* /lib*/libnss_files*; do
             [ -e "$i" ] || continue
-            inst $i
+            inst "$i"
         done
 
-        cp -a /etc/ld.so.conf* $initdir/etc
+        cp -a /etc/ld.so.conf* "$initdir"/etc
         ldconfig -r "$initdir"
     )
 
     # second, install the files needed to make the root filesystem
     (
+        # shellcheck disable=SC2030
+        # shellcheck disable=SC2031
         export initdir=$TESTDIR/overlay
-        . $basedir/dracut-init.sh
+        # shellcheck disable=SC1090
+        . "$basedir"/dracut-init.sh
         inst_multiple sfdisk mkfs.ext3 poweroff cp umount sync dd
         inst_hook initqueue 01 ./create-server-root.sh
         inst_hook initqueue/finished 01 ./finished-false.sh
@@ -409,20 +428,20 @@ EOF
     # create an initramfs that will create the target root filesystem.
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
-    $basedir/dracut.sh -l -i $TESTDIR/overlay / \
+    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
         -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
         -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
         --nomdadmconf \
         --no-hostonly-cmdline -N \
-        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
 
     # Invoke KVM and/or QEMU to actually create the target filesystem.
-    $testdir/run-qemu \
-        -drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext3 \
-        -drive format=raw,index=1,media=disk,file=$TESTDIR/flag.img \
+    "$testdir"/run-qemu \
+        -drive format=raw,index=0,media=disk,file="$TESTDIR"/server.ext3 \
+        -drive format=raw,index=1,media=disk,file="$TESTDIR"/flag.img \
         -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot || return 1
-    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/flag.img || return 1
+        -initrd "$TESTDIR"/initramfs.makeroot || return 1
+    grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created "$TESTDIR"/flag.img || return 1
     rm -fr "$TESTDIR"/overlay
 }
 
@@ -431,11 +450,13 @@ test_setup() {
     make_client_root || return 1
     make_server_root || return 1
 
-    rm -fr $TESTDIR/overlay
+    rm -fr "$TESTDIR"/overlay
     # Make the test image
     (
+        # shellcheck disable=SC2031
         export initdir=$TESTDIR/overlay
-        . $basedir/dracut-init.sh
+        # shellcheck disable=SC1090
+        . "$basedir"/dracut-init.sh
         inst_multiple poweroff shutdown dd
         inst_hook shutdown-emergency 000 ./hard-off.sh
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
@@ -445,30 +466,31 @@ test_setup() {
         #        mkdir -p "${initdir}/lib/systemd/system/sysinit.target.wants"
         #        ln -fs ../debug-shell.service "${initdir}/lib/systemd/system/sysinit.target.wants/debug-shell.service"
 
-        . $TESTDIR/luks.uuid
-        mkdir -p $initdir/etc
-        echo "luks-$ID_FS_UUID /dev/nbd0 /etc/key" > $initdir/etc/crypttab
-        echo -n test > $initdir/etc/key
+        # shellcheck disable=SC1090
+        . "$TESTDIR"/luks.uuid
+        mkdir -p "$initdir"/etc
+        echo "luks-$ID_FS_UUID /dev/nbd0 /etc/key" > "$initdir"/etc/crypttab
+        echo -n test > "$initdir"/etc/key
     )
 
-    $basedir/dracut.sh -l -i $TESTDIR/overlay / \
+    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
         -m "dash udev-rules rootfs-block fs-lib base debug kernel-modules" \
         -d "af_packet piix ide-gd_mod ata_piix ext3 ext3 sd_mod e1000" \
         --no-hostonly-cmdline -N \
-        -f $TESTDIR/initramfs.server $KVERSION || return 1
+        -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1
 
-    $basedir/dracut.sh -l -i $TESTDIR/overlay / \
+    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
         -o "plymouth" \
         -a "debug watchdog" \
         -d "af_packet piix ide-gd_mod ata_piix ext3 ext3 sd_mod e1000 i6300esb ib700wdt" \
         --no-hostonly-cmdline -N \
-        -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
 }
 
 kill_server() {
     if [[ -s $TESTDIR/server.pid ]]; then
-        kill -TERM $(cat $TESTDIR/server.pid)
-        rm -f -- $TESTDIR/server.pid
+        kill -TERM "$(cat "$TESTDIR"/server.pid)"
+        rm -f -- "$TESTDIR"/server.pid
     fi
 }
 
@@ -476,4 +498,5 @@ test_cleanup() {
     kill_server
 }
 
-. $testdir/test-functions
+# shellcheck disable=SC1090
+. "$testdir"/test-functions