summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2015-01-26 11:05:36 +0100
committerHolger Levsen <holger@layer-acht.org>2015-01-26 11:05:36 +0100
commit2ccb4f0a631291f0ae3df1438b60c95d5d51374a (patch)
tree6e1997b377e94d5f37f414f6ec4624bdd73c679e
parent4d5a1b0ae45629af521dfc3d51f54511f658938f (diff)
downloadjenkins.debian.net-2ccb4f0a631291f0ae3df1438b60c95d5d51374a.tar.xz
chroot-install: work around temporarily download problems by repeating the step once
-rwxr-xr-xbin/chroot-installation.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/bin/chroot-installation.sh b/bin/chroot-installation.sh
index 4fa90188..48215117 100755
--- a/bin/chroot-installation.sh
+++ b/bin/chroot-installation.sh
@@ -26,8 +26,10 @@ sleep $SLEEP
export CHROOT_TARGET=$(mktemp -d -p /chroots/ chroot-installation-$1.XXXXXXXXX)
export TMPFILE=$(mktemp -u)
export CTMPFILE=$CHROOT_TARGET/$TMPFILE
+export TMPLOG=$(mktemp)
cleanup_all() {
+ echo "Doing cleanup now."
# test if $CHROOT_TARGET starts with /chroots/
if [ "${CHROOT_TARGET:0:9}" != "/chroots/" ] ; then
echo "HALP. CHROOT_TARGET = $CHROOT_TARGET"
@@ -35,11 +37,19 @@ cleanup_all() {
fi
sudo umount -l $CHROOT_TARGET/proc || fuser -mv $CHROOT_TARGET/proc
sudo rm -rf --one-file-system $CHROOT_TARGET || fuser -mv $CHROOT_TARGET
+ rm -f $TMPLOG
}
execute_ctmpfile() {
chmod +x $CTMPFILE
- sudo chroot $CHROOT_TARGET $TMPFILE
+ sudo chroot $CHROOT_TARGET $TMPFILE 2>&1 | tee $TMPLOG
+ RESULT=$(egrep "Failed to fetch.*Unable to connect to" $TMPLOG)
+ if [ ! -z "$RESULT" ] ; then
+ echo
+ echo "Trying to workaround temporarily failure fetching packages, trying again..."
+ echo
+ sudo chroot $CHROOT_TARGET $TMPFILE
+ fi
rm $CTMPFILE
}