]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(lvmthinpool-monitor): adress shellcheck SC2319
authorBenjamin Drung <benjamin.drung@canonical.com>
Thu, 13 Jun 2024 22:26:31 +0000 (00:26 +0200)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Sat, 15 Jun 2024 12:12:16 +0000 (08:12 -0400)
shellcheck complains:

```
In modules.d/80lvmthinpool-monitor/start-thinpool-monitor.sh line 12:
    [ -n "$_lvm2_thin_device" ] && return $?
                                          ^-- SC2319 (warning): This $? refers to a condition, not a command. Assign to a variable to avoid it being overwritten.
```

Let `is_lvm2_thinp_device` directly return the test exit code.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
modules.d/80lvmthinpool-monitor/start-thinpool-monitor.sh

index 10f4a4bb092d40bfda695e887f933578731ce31c..4a7ccd05b4c87aef5a548c214e441383f01b1a2c 100755 (executable)
@@ -9,7 +9,7 @@ is_lvm2_thinp_device() {
     _lvm2_thin_device=$(lvm lvs -S 'lv_layout=sparse && lv_layout=thin' \
         --nosuffix --noheadings -o vg_name,lv_name "$_device_path" 2> /dev/null)
 
-    [ -n "$_lvm2_thin_device" ] && return $?
+    [ -n "$_lvm2_thin_device" ]
 }
 
 for LV in $LVS; do