]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(dm,dmraid): shellcheck SC2268
authorBenjamin Drung <benjamin.drung@canonical.com>
Wed, 13 Aug 2025 10:27:27 +0000 (12:27 +0200)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Sun, 31 Aug 2025 13:55:56 +0000 (09:55 -0400)
Shellcheck 0.11 complains about SC2268 (style): Avoid x-prefix in
comparisons as it no longer serves a purpose.

modules.d/70dm/dm-shutdown.sh
modules.d/70mdraid/md-shutdown.sh

index 93b62bbc86899326c1cc9e435351ca1646db8872..eeff5be0910713dd859031dcca7221ea04fcb34f 100755 (executable)
@@ -46,13 +46,13 @@ _do_dm_shutdown() {
     info "Disassembling device-mapper devices"
     for dev in /sys/block/dm-*; do
         [ -e "${dev}" ] || continue
-        if [ "x$final" != "x" ]; then
+        if [ -n "$final" ]; then
             _remove_dm "${dev##*/}" "$final" || ret=$?
         else
             _remove_dm "${dev##*/}" "$final" > /dev/null 2>&1 || ret=$?
         fi
     done
-    if [ "x$final" != "x" ]; then
+    if [ -n "$final" ]; then
         info "dmsetup ls --tree"
         dmsetup ls --tree 2>&1 | vinfo
     fi
@@ -60,7 +60,7 @@ _do_dm_shutdown() {
 }
 
 if command -v dmsetup > /dev/null \
-    && [ "x$(dmsetup status)" != "xNo devices found" ]; then
+    && [ "$(dmsetup status)" != "No devices found" ]; then
     _do_dm_shutdown "$1"
 else
     :
index ca768a9cf92506a12cbd8b86fd47e09fab736362..8923f1d1903891b02255b8bb17ee3a4ee5841e70 100755 (executable)
@@ -9,7 +9,7 @@ _do_md_shutdown() {
     info "Disassembling mdraid devices."
     mdadm -vv --stop --scan | vinfo
     ret=$((ret + $?))
-    if [ "x$final" != "x" ]; then
+    if [ -n "$final" ]; then
         info "/proc/mdstat:"
         vinfo < /proc/mdstat
     fi