]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(nbd): shellcheck for modules.d/95nbd
authorHarald Hoyer <harald@redhat.com>
Fri, 26 Mar 2021 09:29:27 +0000 (10:29 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Mon, 29 Mar 2021 11:36:20 +0000 (13:36 +0200)
modules.d/95nbd/.shchkdir [new file with mode: 0644]
modules.d/95nbd/module-setup.sh
modules.d/95nbd/nbdroot.sh
modules.d/95nbd/parse-nbdroot.sh

diff --git a/modules.d/95nbd/.shchkdir b/modules.d/95nbd/.shchkdir
new file mode 100644 (file)
index 0000000..e69de29
index 202fd5ba57e10ff4970a0c28acd87bebcea1904c..aa3570a875b8221dd97bf033ad4d0cba56d62f1c 100755 (executable)
@@ -33,7 +33,7 @@ install() {
     inst_hook cmdline 90 "$moddir/parse-nbdroot.sh"
     inst_script "$moddir/nbdroot.sh" "/sbin/nbdroot"
     if dracut_module_included "systemd-initrd"; then
-        inst_script "$moddir/nbd-generator.sh" $systemdutildir/system-generators/dracut-nbd-generator
+        inst_script "$moddir/nbd-generator.sh" "$systemdutildir"/system-generators/dracut-nbd-generator
     fi
     dracut_need_initqueue
 }
index 2e1d903d3f64a78345b98a4a1d3a6dc115e16081..6fca50eb66ded50168bc23512cf189d7b8dc56f6 100755 (executable)
@@ -14,6 +14,7 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
 [ -z "$3" ] && exit 1
 
 # root is in the form root=nbd:srv:port[:fstype[:rootflags[:nbdopts]]]
+# shellcheck disable=SC2034
 netif="$1"
 nroot="$2"
 NEWROOT="$3"
@@ -89,7 +90,7 @@ fsopts=${fsopts:+$fsopts,}${nbdrw}
 i=0
 while [ ! -b /dev/nbd0 ]; do
     [ $i -ge 20 ] && exit 1
-    if [ $UDEVVERSION -ge 143 ]; then
+    if [ "$UDEVVERSION" -ge 143 ]; then
         udevadm settle --exit-if-exists=/dev/nbd0
     else
         sleep 0.1
@@ -111,7 +112,7 @@ if [ "$root" = "block:/dev/root" -o "$root" = "dhcp" ]; then
 
         printf '/bin/mount %s\n' \
             "$NEWROOT" \
-            > $hookdir/mount/01-$$-nbd.sh
+            > "$hookdir"/mount/01-$$-nbd.sh
     fi
     # if we're on systemd, use the nbd-generator script
     # to create the /sysroot mount.
@@ -129,7 +130,7 @@ else
 fi
 
 nbd-client -check /dev/nbd0 > /dev/null \
-    || nbd-client "$nbdserver" $nbdport /dev/nbd0 $preopts $opts || exit 1
+    || nbd-client "$nbdserver" "$nbdport" /dev/nbd0 "$preopts" "$opts" || exit 1
 
 # NBD doesn't emit uevents when it gets connected, so kick it
 echo change > /sys/block/nbd0/uevent
index 354208169a8409b1957228de301e000cc1a2e106..1c2e063815c21df97560e29ae7f56d1118ec07f3 100755 (executable)
@@ -52,6 +52,7 @@ unset nroot
 incol2 /proc/devices nbd || modprobe nbd || die "nbdroot requested but kernel/initrd does not support nbd"
 
 # Done, all good!
+# shellcheck disable=SC2034
 rootok=1
 
 # Shut up init error check