Patchwork [2/2] Check for valid chroots

login
register
mail settings
Submitter Chase Douglas
Date Feb. 15, 2010, 4:20 p.m.
Message ID <1266250823-12394-3-git-send-email-chase.douglas@canonical.com>
Download mbox | patch
Permalink /patch/45399/
State Accepted
Delegated to: Stefan Bader
Headers show

Comments

Chase Douglas - Feb. 15, 2010, 4:20 p.m.
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@canonical.com>
---
 buildscripts/build-create-host |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch

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;