[lvm-devel] [PATCH] match only full vg names not substrings when importing clones

chris procter chris-procter at talk21.com
Wed Dec 16 17:52:34 UTC 2009


Currently if you have a vg CDSUATL and use vgimportclone.sh to rename a clone to CDSUAT it will decide CDSUAT==CDSUATL and append a number to ensure uniqueness. This is annoying. Heres a patch fix it. I've also changed the interpreter line to /bin/bash because =~ is a bash extension not supported by anything else that might be symlinked from /bin/sh.



diff -r 09e6fb927a7f -r 2114b6a959b8 scripts/vgimportclone.sh
--- a/scripts/vgimportclone.sh    Tue Dec 15 20:07:26 2009 +0000
+++ b/scripts/vgimportclone.sh    Tue Dec 15 20:35:19 2009 +0000
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Copyright (C) 2009 Chris Procter All rights reserved.
 # Copyright (C) 2009 Red Hat, Inc. All rights reserved.
@@ -52,7 +52,7 @@
     NAME="${BNAME}"
     I=0
 
-    while [[ "${VGLIST}" =~ "${NAME}" ]]
+    while [[ "${VGLIST}" =~ "[[:space:]]${NAME}[[:space:]]" ]]
     do
         I=$(($I+1))
         NAME="${BNAME}$I"


      




More information about the lvm-devel mailing list