]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(usrmount): shellcheck for modules.d/98usrmount
authorHarald Hoyer <harald@redhat.com>
Fri, 26 Mar 2021 09:29:33 +0000 (10:29 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Tue, 30 Mar 2021 14:35:31 +0000 (16:35 +0200)
modules.d/98usrmount/.shchkdir [new file with mode: 0644]
modules.d/98usrmount/mount-usr.sh

diff --git a/modules.d/98usrmount/.shchkdir b/modules.d/98usrmount/.shchkdir
new file mode 100644 (file)
index 0000000..e69de29
index 7c8fa63142b1727216d260b43143cf67decf9577..23ed06aa2ef1ec09b6f7199a07b69de3606c0980 100755 (executable)
@@ -6,12 +6,13 @@ type fsck_single > /dev/null 2>&1 || . /lib/fs-lib.sh
 filtersubvol() {
     local _oldifs
     _oldifs="$IFS"
-    IFS=","
-    set $*
+    local IFS=","
+    # shellcheck disable=SC2086
+    set -- $1
     IFS="$_oldifs"
     while [ $# -gt 0 ]; do
         case $1 in
-            subvol\=*) : ;;
+            'subvol='*) : ;;
             *) printf '%s' "${1}," ;;
         esac
         shift
@@ -31,6 +32,7 @@ fsck_usr() {
     if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck; then
         _fsckoptions="-f $_fsckoptions"
     elif [ -f "$NEWROOT"/.autofsck ]; then
+        # shellcheck disable=SC1090
         [ -f "$NEWROOT"/etc/sysconfig/autofsck ] && . "$NEWROOT"/etc/sysconfig/autofsck
         if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
             AUTOFSCK_OPT="$AUTOFSCK_OPT -f"
@@ -48,15 +50,15 @@ fsck_usr() {
 }
 
 mount_usr() {
-    local _dev _mp _fs _opts _rest _usr_found _ret _freq _passno
+    local _dev _mp _fs _opts _ _usr_found _ _freq _passno
     # check, if we have to mount the /usr filesystem
-    while read _dev _mp _fs _opts _freq _passno || [ -n "$_dev" ]; do
+    while read -r _dev _mp _fs _opts _freq _passno || [ -n "$_dev" ]; do
         [ "${_dev%%#*}" != "$_dev" ] && continue
         if [ "$_mp" = "/usr" ]; then
             _dev="$(label_uuid_to_dev "$_dev")"
 
             if strstr "$_opts" "subvol=" \
-                && [ "${root#block:}" -ef $_dev ] \
+                && [ "${root#block:}" -ef "$_dev" ] \
                 && [ -n "$rflags" ]; then
                 # for btrfs subvolumes we have to mount /usr with the same rflags
                 rflags=$(filtersubvol "$rflags")