From e4c788b026c60a1f58d6386b276a90d8d2aae325 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Wed, 9 Sep 2015 10:56:32 +0200 Subject: fix logic to detect network failures --- bin/schroot-create.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bin/schroot-create.sh') diff --git a/bin/schroot-create.sh b/bin/schroot-create.sh index 427dc2a8..e67cd28b 100755 --- a/bin/schroot-create.sh +++ b/bin/schroot-create.sh @@ -102,7 +102,7 @@ robust_chroot_apt() { sudo chroot $CHROOT_TARGET apt-get $@ | tee $TMPLOG RESULT=$(egrep 'Failed to fetch.*(Unable to connect to|Connection failed|Size mismatch|Cannot initiate the connection to|Bad Gateway)' $TMPLOG) set -e - if [ -z "$RESULT" ] ; then + if [ ! -z "$RESULT" ] ; then echo "$(date -u) - 'apt-get $@' failed, sleeping 5min before retrying..." sleep 5m sudo chroot $CHROOT_TARGET apt-get $@ @@ -119,7 +119,7 @@ bootstrap() { sudo debootstrap $SUITE $CHROOT_TARGET $MIRROR | tee $TMPLOG RESULT=$(egrep "E: Couldn't download packages" $TMPLOG) set -e - if [ -z "$RESULT" ] ; then + if [ ! -z "$RESULT" ] ; then echo "$(date -u) - initial debootstrap failed, sleeping 5min before retrying..." sudo rm -rf --one-file-system $CHROOT_TARGET sleep 5m -- cgit v1.2.3-54-g00ecf