]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(dm): shellcheck for modules.d/90dm
authorHarald Hoyer <harald@redhat.com>
Fri, 26 Mar 2021 09:29:19 +0000 (10:29 +0100)
committerDaniel Molkentin <daniel@molkentin.de>
Tue, 30 Mar 2021 08:28:54 +0000 (10:28 +0200)
modules.d/90dm/.shchkdir [new file with mode: 0644]
modules.d/90dm/dm-shutdown.sh

diff --git a/modules.d/90dm/.shchkdir b/modules.d/90dm/.shchkdir
new file mode 100644 (file)
index 0000000..e69de29
index 0a8a1030257758a13a4533c60ad81d57ad6bff9f..5f35fa72b5a465bbafc4fe2c19602a0861ab363c 100755 (executable)
@@ -5,19 +5,19 @@ _remove_dm() {
     local s
     local devname
 
-    for s in /sys/block/${dev}/holders/dm-*; do
-        [ -e ${s} ] || continue
-        _remove_dm ${s##*/}
+    for s in /sys/block/"${dev}"/holders/dm-*; do
+        [ -e "${s}" ] || continue
+        _remove_dm "${s##*/}"
     done
     # multipath devices might have MD devices on top,
     # which are removed after this script. So do not
     # remove those to avoid spurious errors
-    case $(cat /sys/block/${dev}/dm/uuid) in
+    case $(cat /sys/block/"${dev}"/dm/uuid) in
         mpath-*)
             return 0
             ;;
         *)
-            devname=$(cat /sys/block/${dev}/dm/name)
+            devname=$(cat /sys/block/"${dev}"/dm/name)
             dmsetup -v --noudevsync remove "$devname" || return $?
             ;;
     esac
@@ -31,11 +31,11 @@ _do_dm_shutdown() {
 
     info "Disassembling device-mapper devices"
     for dev in /sys/block/dm-*; do
-        [ -e ${dev} ] || continue
+        [ -e "${dev}" ] || continue
         if [ "x$final" != "x" ]; then
-            _remove_dm ${dev##*/} || ret=$?
+            _remove_dm "${dev##*/}" || ret=$?
         else
-            _remove_dm ${dev##*/} > /dev/null 2>&1 || ret=$?
+            _remove_dm "${dev##*/}" > /dev/null 2>&1 || ret=$?
         fi
     done
     if [ "x$final" != "x" ]; then
@@ -47,7 +47,7 @@ _do_dm_shutdown() {
 
 if command -v dmsetup > /dev/null \
     && [ "x$(dmsetup status)" != "xNo devices found" ]; then
-    _do_dm_shutdown $1
+    _do_dm_shutdown "$1"
 else
     :
 fi