Skip to contentSkip to conversation

match only full vg names not substrings when importing clones

PATCH New chris procter 1 participant 1 message Dec 16, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 match only full vg names not substrings when importing clones

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.

scripts/vgimportclone.sh Tue Dec 15 20:35:19 2009 +0000 renamed from scripts/vgimportclone.sh Tue Dec 15 20:07:26 2009 +0000 +2 -2
diff -r 09e6fb927a7f -r 2114b6a959b8 scripts/vgimportclone.sh
@@ -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"