uvol: fix list output on LVM backend
authorDaniel Golle <daniel@makrotopia.org>
Tue, 22 Mar 2022 14:16:58 +0000 (14:16 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Tue, 22 Mar 2022 14:19:35 +0000 (14:19 +0000)
'uvol list' was broken when introducing support for the hidden volumes.
Fix that by not using 'continue' keyword to break the loop (as that
lead to skipping 'json_select ..') and using if-clause instead.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
utils/uvol/files/lvm.sh

index c7e93f13f29971db4f811794aabe4c6004d8147a..6dd5139d5d788aa3aa8ebd122356a6301503428f 100644 (file)
@@ -320,17 +320,18 @@ listvols() {
                        lv_mode="${lv_name:0:2}"
                        lv_name="${lv_name:3}"
                        lv_size=${lv_size%B}
-                       [ "${lv_name:0:1}" = "." ] && continue
-                       if [ "$json_output" = "1" ]; then
-                               [ "$json_notfirst" = "1" ] && echo ","
-                               echo -e "\t{"
-                               echo -e "\t\t\"name\": \"$lv_name\","
-                               echo -e "\t\t\"mode\": \"$lv_mode\","
-                               echo -e "\t\t\"size\": $lv_size"
-                               echo -n -e "\t}"
-                               json_notfirst=1
-                       else
-                               echo "$lv_name $lv_mode $lv_size"
+                       if [ "${lv_name:0:1}" != "." ]; then
+                               if [ "$json_output" = "1" ]; then
+                                       [ "$json_notfirst" = "1" ] && echo ","
+                                       echo -e "\t{"
+                                       echo -e "\t\t\"name\": \"$lv_name\","
+                                       echo -e "\t\t\"mode\": \"$lv_mode\","
+                                       echo -e "\t\t\"size\": $lv_size"
+                                       echo -n -e "\t}"
+                                       json_notfirst=1
+                               else
+                                       echo "$lv_name $lv_mode $lv_size"
+                               fi
                        fi
                        json_select ..
                done