]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(nbd): shellcheck regression
authorHarald Hoyer <harald@redhat.com>
Wed, 31 Mar 2021 09:15:46 +0000 (11:15 +0200)
committerHarald Hoyer <harald@hoyer.xyz>
Wed, 31 Mar 2021 19:32:36 +0000 (21:32 +0200)
`$opts`, `$preopts` and `$nbdport` shouldn't have been quoted as they
can expand to multiple options.

Fixes: https://github.com/dracutdevs/dracut/issues/1270
modules.d/95nbd/nbdroot.sh

index 6fca50eb66ded50168bc23512cf189d7b8dc56f6..b485c081f2d9ae1270ea4a84d59d414aad5f3c6e 100755 (executable)
@@ -129,8 +129,10 @@ else
     nbdport="-name $nbdport"
 fi
 
-nbd-client -check /dev/nbd0 > /dev/null \
-    || nbd-client "$nbdserver" "$nbdport" /dev/nbd0 "$preopts" "$opts" || exit 1
+if ! nbd-client -check /dev/nbd0 > /dev/null; then
+    # shellcheck disable=SC2086
+    nbd-client "$nbdserver" $nbdport /dev/nbd0 $preopts $opts || exit 1
+fi
 
 # NBD doesn't emit uevents when it gets connected, so kick it
 echo change > /sys/block/nbd0/uevent