From 714503fed307a5a8fff3eed75b99d6025d73a334 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Sun, 1 Apr 2012 15:12:05 +0200 Subject: [PATCH] vtest-init-lxc is more strict when checking if container already exists --- vbuild-init-lxc.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/vbuild-init-lxc.sh b/vbuild-init-lxc.sh index 82db67ef..fa7d1a1e 100755 --- a/vbuild-init-lxc.sh +++ b/vbuild-init-lxc.sh @@ -860,11 +860,9 @@ function main () { # need lxc installed before we can run lxc-ls prepare_host - if [ ! -z "$(lxc-ls | grep $lxc)" ];then - echo "container $lxc exists" - exit 1 - fi - + # be strict on lxc-lines matching name exactly using ^$ + # as otherwise the timestamps may show up here + lxc-ls | grep -q '^'"$lxc"'$' && { echo "container $lxc already exists - exiting" ; exit 1 ; } path=/var/lib/lxc rootfs_path=$path/$lxc/rootfs -- 2.47.0