summaryrefslogtreecommitdiffstats
path: root/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh
diff options
context:
space:
mode:
authorJonas Bjurel <jonas.bjurel@ericsson.com>2015-11-25 11:32:57 +0100
committerJonas Bjurel <jonas.bjurel@ericsson.com>2015-11-27 10:24:23 +0100
commit24a95306d2564b272b5320e9149d9aea70b4061c (patch)
tree8c1a2c9f7acbfed41f8ebc56a8ae1f7d316f7cff /build/f_isoroot/f_repobuild/select_ubuntu_repo.sh
parent7077376d6e0ff0dec77080fa21b75911b811475d (diff)
Restructcture of the directory layout
Restructure of the directory layout due to move of Fuel into it's own repo JIRA: FUEL-85 Change-Id: I3647e1992a508f29dce06a5d6c790725c527f6f5 Signed-off-by: Jonas Bjurel <jonas.bjurel@ericsson.com>
Diffstat (limited to 'build/f_isoroot/f_repobuild/select_ubuntu_repo.sh')
-rwxr-xr-xbuild/f_isoroot/f_repobuild/select_ubuntu_repo.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh b/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh
new file mode 100755
index 000000000..cb05fe136
--- /dev/null
+++ b/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+RSYNC="rsync -4 --contimeout 5 --no-motd --list-only"
+
+# try to choose close ubuntu mirror which support rsync protocol
+# https://bugs.launchpad.net/fuel/+bug/1459252
+
+# A minor modificiation of Michal Skalski's original Makefile version
+# to only consider repos where no repo updates are in progress (as
+# that may have us hanging quite a while otherwise). If no suitable
+# local mirror can be found after four attempts, the default archive
+# is returned instead.
+
+cnt=0
+while [ $cnt -lt 4 ]
+do
+ for url in $(curl -s http://mirrors.ubuntu.com/mirrors.txt)
+ do
+ host=$(echo $url | cut -d'/' -f3)
+ if $RSYNC "${host}::ubuntu/." &> /dev/null
+ then
+ if ! $RSYNC "${host}::ubuntu/Archive-Update-in-Progress*" &> /dev/null
+ then
+ echo "$host"
+ exit 0
+ fi
+ fi
+ done
+ cnt=$[cnt + 1]
+ sleep 15
+done
+echo "archive.ubuntu.com"
+