]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix: move shellcheck SC3045 override to occurrences
authorBenjamin Drung <benjamin.drung@canonical.com>
Thu, 13 Jun 2024 11:24:47 +0000 (13:24 +0200)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Thu, 13 Jun 2024 21:32:20 +0000 (17:32 -0400)
Move the shellcheck overrides for `SC3045` to the individual occurrences
instead of disabling this check globally to not hide valid complains
like:

```
In modules.d/01fips/fips.sh line 97:
    read -d '' -r FIPSMODULES < /etc/fipsmodules
         ^-- SC3045 (warning): In POSIX sh, read -d is undefined.
```

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
.shellcheckrc
modules.d/98dracut-systemd/dracut-cmdline-ask.sh
modules.d/99base/init.sh

index d4448f1d27d96feac1ebc113be05e57ab316b2cd..90d03cb9dd382d897a802832d2a65b5e7a608562 100644 (file)
@@ -23,8 +23,3 @@ disable=SC3043
 # https://github.com/koalaman/shellcheck/wiki/SC3013
 # ... but dash supports it
 disable=SC3013
-
-# SC3045: In POSIX sh, read -p is undefined.
-# https://github.com/koalaman/shellcheck/wiki/SC3045
-# ... but dash supports it
-disable=SC3045
index 13c4f204321f6baf582a8a6a72ae9aca48409087..895cd90d2f7e45da666e4ccf1eeac98286cc891d 100755 (executable)
@@ -14,6 +14,8 @@ echo
 echo
 echo
 echo "Enter additional kernel command line parameter (end with ctrl-d or .)"
+# In POSIX sh, read -p is undefined, but dash supports it
+# shellcheck disable=SC3045
 while read -r -p "> " ${BASH:+-e} line || [ -n "$line" ]; do
     [ "$line" = "." ] && break
     [ -n "$line" ] && printf -- "%s\n" "$line" >> /etc/cmdline.d/99-cmdline-ask.conf
index 727f2795e5b67c254c70c8b1050bf563280fae07..2a095a6e795b5a63d6dcf952e95f8132248438f1 100755 (executable)
@@ -109,6 +109,8 @@ source_conf /etc/conf.d
 
 if getarg "rd.cmdline=ask"; then
     echo "Enter additional kernel command line parameter (end with ctrl-d or .)"
+    # In POSIX sh, read -p is undefined, but dash supports it
+    # shellcheck disable=SC3045
     while read -r -p "> " ${BASH:+-e} line || [ -n "$line" ]; do
         [ "$line" = "." ] && break
         echo "$line" >> /etc/cmdline.d/99-cmdline-ask.conf