From d426d7e7099b23d169e396292a25ab97cbfc2000 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 7 Jul 2017 23:03:08 +0200 Subject: [PATCH] tests: aux.sh check for already present config 'aux lvmconf' detects if new config needs to be regenerated. --- test/lib/aux.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/lib/aux.sh b/test/lib/aux.sh index 3f54dbbf2..13be7c581 100644 --- a/test/lib/aux.sh +++ b/test/lib/aux.sh @@ -1226,6 +1226,18 @@ EOF lvmconf() { unset profile_name + test $# -eq 0 || { + # Compare if passed args aren't already all in generated lvm.conf + local needed=0 + for i in "$@"; do + val=$(grep "${i%%[={ ]*}" CONFIG_VALUES 2>/dev/null | tail -1) || { needed=1; break; } + test "$val" = "$i" || { needed=1; break; } + done + test "$needed" -eq 0 && { + echo "## LVMCONF: values are already there, skipping." + return 0 # not needed + } + } generate_config "$@" mv -f CONFIG "$LVM_SYSTEM_DIR/lvm.conf" }