mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-08 08:58:50 +03:00
tests: lvmconf update
New lvmconf function is using bash associative arrays - however older systems like RHEL5 doesn't provide this feature. In this case stay with older variant. Restore support for use case like this: aux lvmconf 'tags/@foo {}'
This commit is contained in:
parent
13fea87960
commit
3706abde5e
@ -786,14 +786,28 @@ EOF
|
||||
echo "$v"
|
||||
done >> "$config_values"
|
||||
|
||||
declare -A CONF
|
||||
declare -A CONF || {
|
||||
# Associative arrays is not available
|
||||
local s
|
||||
for s in $(cut -f1 -d/ "$config_values" | sort | uniq); do
|
||||
echo "$s {"
|
||||
local k
|
||||
for k in $(grep ^"$s"/ "$config_values" | cut -f1 -d= | sed -e 's, *$,,' | sort | uniq); do
|
||||
grep "^$k" "$config_values" | tail -n 1 | sed -e "s,^$s/, ,"
|
||||
done
|
||||
echo "}"
|
||||
echo
|
||||
done | tee "$config" | sed -e "s,^,## LVMCONF: ,"
|
||||
return 0
|
||||
}
|
||||
|
||||
local sec
|
||||
local last_sec
|
||||
|
||||
# read sequential list and put into associative array
|
||||
while IFS=$IFS_NL read -r v; do
|
||||
# trim white-space-chars via echo when inserting
|
||||
CONF[$(echo ${v%%=*})]=${v##*=}
|
||||
CONF[$(echo ${v%%[={]*})]=${v#*/}
|
||||
done < "$config_values"
|
||||
|
||||
# sort by section and iterate through them
|
||||
@ -804,7 +818,7 @@ EOF
|
||||
echo "$sec {"
|
||||
last_sec=$sec
|
||||
}
|
||||
echo " ${v#*/} =${CONF[$v]}"
|
||||
echo " ${CONF[$v]}"
|
||||
done > "$config"
|
||||
echo "}" >> "$config"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user