[PATCH 2/2] Check for valid chroots

Chase Douglas chase.douglas at canonical.com
Mon Feb 15 16:20:23 UTC 2010


Before, if schroot or dchroot were found they were used (in that
order) whether or not there were any chroots defined. This change
checks for whether any chroots are available before assuming the
found chroot executable will work.

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 buildscripts/build-create-host |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/buildscripts/build-create-host b/buildscripts/build-create-host
index 5bf163e..14fd228 100755
--- a/buildscripts/build-create-host
+++ b/buildscripts/build-create-host
@@ -19,9 +19,9 @@ CMD='if [ "\`type -p dpkg-architecture\`" != "" ]; then
 else
 	echo HOSTARCH="\`dpkg --print-architecture\`";
 fi;
-if [ "\`type -p schroot\`" != "" ]; then
+if [ "\`type -p schroot\`" != "" ] && ! schroot -l 2>&1 | egrep -q "(W|E): "; then
 	CHROOTCMD="schroot";
-elif [ "\`type -p dchroot\`" != "" ]; then
+elif [ "\`type -p dchroot\`" != ""  ] && ! dchroot -l 2>&1 | egrep -q "(W|E): "; then
 	CHROOTCMD="dchroot";
 else
 	exit 1;
-- 
1.6.3.3





More information about the kernel-team mailing list