]> sourceware.org Git - lvm2.git/commitdiff
vdo: avoid using of valuesonly
authorZdenek Kabelac <zkabelac@redhat.com>
Wed, 13 Sep 2023 21:13:27 +0000 (23:13 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 13 Sep 2023 23:44:27 +0000 (01:44 +0200)
To retain backward compatibility with some older version of lvm
avoid using --valuesonly option with lvmconfig.

scripts/lvm_import_vdo.sh

index b9f24cfda32f52ba4d86a3ac2d2963bd4cc4385a..90fc3f9751b8a956d65222218d084f095064e51a 100755 (executable)
@@ -531,9 +531,9 @@ convert_non_lv_() {
        dry snapshot_merge_ "$DEVICE"
 
        # For systems using devicesfile add 'merged' PV into system.devices.
-       if [ "$("$LVM" lvmconfig --valuesonly devices/use_devicesfile --typeconfig full)" = "1" ]; then
-               dry "$LVM" lvmdevices --adddev "$DEVICE"
-       fi
+       # Bypassing use of --valuesonly to keep compatibility with older lvm.
+       local usedev=$("$LVM" lvmconfig --typeconfig full devices/use_devicesfile || true)
+       [ "${usedev#*=" = "1" ] && dry "$LVM" lvmdevices --adddev "$DEVICE"
 
        # Restore auto activation for a VG
        dry "$LVM" vgchange --setautoactivation y $VERB $FORCE "$VGNAME"
This page took 0.036548 seconds and 5 git commands to generate.