From 394c79fe428faa9c50ed1db6d750b363b44130b9 Mon Sep 17 00:00:00 2001 From: Michal Skalski Date: Thu, 21 Jan 2016 02:17:11 +0100 Subject: Use mirrors snapshots Add logic to fetch information about last suitable snapshot which can be used to download ubuntu packages. This is for example use to build community ISO [1]. This should help in case of snapshot switch [2]. [1] https://github.com/fuel-infra/jenkins-jobs/blob/master/servers/fuel-ci/8.0/builders/community.all.sh#L36-L40 [2] https://bugs.launchpad.net/fuel/+bug/1493390/comments/9 Change-Id: Id5a8d41278561473ea4844631bfefa0049e64dbc Signed-off-by: Michal Skalski --- build/f_isoroot/f_repobuild/select_ubuntu_repo.sh | 28 ++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'build/f_isoroot/f_repobuild') diff --git a/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh b/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh index cb05fe136..992359afd 100755 --- a/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh +++ b/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh @@ -11,6 +11,19 @@ RSYNC="rsync -4 --contimeout 5 --no-motd --list-only" # local mirror can be found after four attempts, the default archive # is returned instead. +return_url=0 + +while [ "$1" != "" ]; do + case $1 in + -u | --url ) shift + return_url=1 + ;; + # Shift all the parameters down by one + esac + shift +done + + cnt=0 while [ $cnt -lt 4 ] do @@ -21,13 +34,22 @@ do then if ! $RSYNC "${host}::ubuntu/Archive-Update-in-Progress*" &> /dev/null then - echo "$host" - exit 0 + if [ "$return_url" = "1" ]; then + echo "$url" + exit 0 + else + echo "$host" + exit 0 + fi fi fi done cnt=$[cnt + 1] sleep 15 done -echo "archive.ubuntu.com" +if [ "$return_url" = "1" ]; then + echo "http://archive.ubuntu.com/ubuntu/" +else + echo "archive.ubuntu.com" +fi -- cgit 1.2.3-korg