[Git][noosfero/noosfero][master] quick-start: retry apt update/upgrade up to 3 times
Antonio Terceiro
gitlab at mg.gitlab.com
Thu Jan 28 16:24:20 BRST 2016
Antonio Terceiro pushed to branch master at Noosfero / noosfero
Commits:
323089c4 by Antonio Terceiro at 2016-01-28T16:23:41-02:00
quick-start: retry apt update/upgrade up to 3 times
This will avoid, or at least reduce the chances of, having the CI builds
falling over on temporary network failures.
- - - - -
1 changed file:
- script/install-dependencies/debian-jessie.sh
Changes:
=====================================
script/install-dependencies/debian-jessie.sh
=====================================
--- a/script/install-dependencies/debian-jessie.sh
+++ b/script/install-dependencies/debian-jessie.sh
@@ -61,12 +61,26 @@ else
sudo rm -f /etc/apt/sources.list.d/local.list
fi
+retry() {
+ local times="$1"
+ shift
+ local i=0
+ local rc=0
+ while [ $i -lt "$times" ]; do
+ echo '$' "$@"
+ "$@" && rc=0 || rc=$?
+ i=$(($i + 1))
+ if [ $rc -eq 0 ]; then return 0; fi
+ done
+ return $rc
+}
+
# update system, at most every 6h (internal between Debian mirror pushes)
timestamp=/tmp/.noosfero.apt-get.update
now=$(date +%s)
if [ ! -f $timestamp ] || [ $(($now - $(stat --format=%Y $timestamp))) -gt 21600 ]; then
- run sudo apt-get update
- run sudo apt-get -qy dist-upgrade
+ run retry 3 sudo apt-get update
+ run retry 3 sudo apt-get -qy dist-upgrade
touch $timestamp
fi
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/323089c4f1eb40508795e3efb363569313c42518
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160128/632d2ab1/attachment-0001.html>
More information about the Noosfero-dev
mailing list