]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(fstab-sys): shellcheck for modules.d/95fstab-sys
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:58 +0000 (13:36 +0200)
modules.d/95fstab-sys/.shchkdir [new file with mode: 0644]
modules.d/95fstab-sys/mount-sys.sh

diff --git a/modules.d/95fstab-sys/.shchkdir b/modules.d/95fstab-sys/.shchkdir
new file mode 100644 (file)
index 0000000..e69de29
index 0ae10166380c3dd5f24be0fec2a5b4a3989ca734..bb4bcdb33f0e2b1026b27f19d5168af2b7059ae6 100755 (executable)
@@ -4,24 +4,24 @@ type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 type det_fs > /dev/null 2>&1 || . /lib/fs-lib.sh
 
 fstab_mount() {
-    local _dev _mp _fs _opts _dump _pass _rest
+    local _dev _mp _fs _opts _pass
     test -e "$1" || return 1
     info "Mounting from $1"
-    while read _dev _mp _fs _opts _dump _pass _rest || [ -n "$_dev" ]; do
+    while read -r _dev _mp _fs _opts _ _pass _ || [ -n "$_dev" ]; do
         [ -z "${_dev%%#*}" ] && continue # Skip comment lines
-        ismounted $_mp && continue       # Skip mounted filesystem
+        ismounted "$_mp" && continue     # Skip mounted filesystem
         if [ "$_pass" -gt 0 ] && ! strstr "$_opts" _netdev; then
             fsck_single "$_dev" "$_fs" "$_opts"
         fi
         _fs=$(det_fs "$_dev" "$_fs")
         info "Mounting $_dev"
         if [ -d "$NEWROOT/$_mp" ]; then
-            mount -v -t $_fs -o $_opts $_dev "$NEWROOT/$_mp" 2>&1 | vinfo
+            mount -v -t "$_fs" -o "$_opts" "$_dev" "$NEWROOT/$_mp" 2>&1 | vinfo
         else
             [ -d "$_mp" ] || mkdir -p "$_mp"
-            mount -v -t $_fs -o $_opts $_dev $_mp 2>&1 | vinfo
+            mount -v -t "$_fs" -o "$_opts" "$_dev" "$_mp" 2>&1 | vinfo
         fi
-    done < $1
+    done < "$1"
     return 0
 }
 
@@ -32,8 +32,8 @@ if [ -z "$DRACUT_SYSTEMD" ]; then
 fi
 
 # prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys
-if [ -f $NEWROOT/etc/fstab.sys ]; then
-    fstab_mount $NEWROOT/etc/fstab.sys
+if [ -f "$NEWROOT"/etc/fstab.sys ]; then
+    fstab_mount "$NEWROOT"/etc/fstab.sys
 elif [ -f /etc/fstab.sys ]; then
     fstab_mount /etc/fstab.sys
 fi