summaryrefslogtreecommitdiffstats
path: root/scripts/vgimportclone.sh
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2011-09-07 08:31:16 +0000
committerZdenek Kabelac <zkabelac@redhat.com>2011-09-07 08:31:16 +0000
commit77f771ebc3d057185414e5985e7c0a7ebbb99c34 (patch)
treeaff7212f817f7238d4f83ad2eee6871b0c3fcead /scripts/vgimportclone.sh
parentbb6f9b10db478217585860e719d12dd062d9d728 (diff)
downloadlvm2-77f771ebc3d057185414e5985e7c0a7ebbb99c34.tar.gz
lvm2-77f771ebc3d057185414e5985e7c0a7ebbb99c34.tar.xz
lvm2-77f771ebc3d057185414e5985e7c0a7ebbb99c34.zip
Replace char class :space: with explicit chars
Some major distributions are still using 'mawk' and they are not using the latest version - we end here with hidden dependency on the latest version of mawk (1.3.4) while i.e. Debian Lenny seems to stay with 1.3.3. So we end with completely broken vgimportclone script on such system. We would need to check for proper support of :space: and abort build if it doesn't work or simplier replace [:space:] with [ \t] which seems sufficient to make it work (as can be seen in this patch) A better fix would be to use command line parameter override - leaving as FIXME comment. This patch makes t-vgimportclone.sh test passing on Lenny.
Diffstat (limited to 'scripts/vgimportclone.sh')
-rwxr-xr-xscripts/vgimportclone.sh11
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/vgimportclone.sh b/scripts/vgimportclone.sh
index 731b860e..149120e1 100755
--- a/scripts/vgimportclone.sh
+++ b/scripts/vgimportclone.sh
@@ -242,13 +242,14 @@ export FILTER="filter=[ ${FILTER} \"r|.*|\" ]"
LVMCONF=${TMP_LVM_SYSTEM_DIR}/lvm.conf
+# FIXME convert to cmdline override
"$LVM" dumpconfig ${LVM_OPTS} | \
"$AWK" -v DEV=${TMP_LVM_SYSTEM_DIR} -v CACHE=${TMP_LVM_SYSTEM_DIR}/.cache \
-v CACHE_DIR=${TMP_LVM_SYSTEM_DIR}/cache \
- '/^[[:space:]]*filter[[:space:]]*=/{print ENVIRON["FILTER"];next} \
- /^[[:space:]]*scan[[:space:]]*=/{print "scan = [ \"" DEV "\" ]";next} \
- /^[[:space:]]*cache[[:space:]]*=/{print "cache = \"" CACHE "\"";next} \
- /^[[:space:]]*cache_dir[[:space:]]*=/{print "cache_dir = \"" CACHE_DIR "\"";next} \
+ '/^[ \t]*filter[ \t]*=/{print ENVIRON["FILTER"];next} \
+ /^[ \t]*scan[ \t]*=/{print "scan = [ \"" DEV "\" ]";next} \
+ /^[ \t]*cache[ \t]*=/{print "cache = \"" CACHE "\"";next} \
+ /^[ \t]*cache_dir[ \t]*=/{print "cache_dir = \"" CACHE_DIR "\"";next} \
{print $0}' > ${LVMCONF}
checkvalue $? "Failed to generate ${LVMCONF}"
@@ -282,7 +283,7 @@ checkvalue $? "PV info could not be collected without errors"
# output VG info so each line looks like: name:exported?:disk1,disk2,...
VGINFO=`echo "${PVINFO}" | \
- "$AWK" -F : '{{sub(/^[[:space:]]*/,"")} \
+ "$AWK" -F : '{{sub(/^[ \t]*/,"")} \
{sub(/unknown device/,"unknown_device")} \
{vg[$2]=$1","vg[$2]} if($3 ~ /^..x/){x[$2]="x"}} \
END{for(k in vg){printf("%s:%s:%s\n", k, x[k], vg[k])}}'`