]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(lunmask): shellcheck regression
authorHarald Hoyer <harald@redhat.com>
Wed, 31 Mar 2021 09:11:00 +0000 (11:11 +0200)
committerHarald Hoyer <harald@hoyer.xyz>
Wed, 31 Mar 2021 10:13:31 +0000 (12:13 +0200)
`parse-lunmask.sh` is not a bash script
and dash doesn't understand `read -a`.

Revert to the initial code.

Fixes: https://github.com/dracutdevs/dracut/issues/1271
modules.d/95lunmask/parse-lunmask.sh

index 033572524d2c72ea4d6518db191353f70c92754d..504c76d8637581408df27c37a7d3cf139df19d18 100755 (executable)
@@ -24,11 +24,17 @@ EOF
 }
 
 for lunmask_arg in $(getargs rd.lunmask); do
-    IFS="," read -r -a _args <<< "$lunmask_arg"
-    if [ -d /sys/module/scsi_mod ]; then
-        printf "manual" > /sys/module/scsi_mod/parameters/scan
-    elif [ ! -f /etc/modprobe.d/95lunmask.conf ]; then
-        echo "options scsi_mod scan=manual" > /etc/modprobe.d/95lunmask.conf
-    fi
-    create_udev_rule "${_args[@]}"
+    (
+        local OLDIFS="$IFS"
+        local IFS=","
+        # shellcheck disable=SC2086
+        set $lunmask_arg
+        IFS="$OLDIFS"
+        if [ -d /sys/module/scsi_mod ]; then
+            printf "manual" > /sys/module/scsi_mod/parameters/scan
+        elif [ ! -f /etc/modprobe.d/95lunmask.conf ]; then
+            echo "options scsi_mod scan=manual" > /etc/modprobe.d/95lunmask.conf
+        fi
+        create_udev_rule "$1" "$2" "$3"
+    )
 done