X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=build%2Ff_isoroot%2Ff_repobuild%2Fselect_ubuntu_repo.sh;h=bfaec74f1841d3e29638ab7d67faa50288e0c670;hb=f9e50fa686599ff4a7e94805279820d3cdfefbc4;hp=cb05fe136168ab8ea6bfa4d04f43ce34e2475ad8;hpb=24a95306d2564b272b5320e9149d9aea70b4061c;p=fuel.git diff --git a/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh b/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh index cb05fe136..bfaec74f1 100755 --- a/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh +++ b/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh @@ -1,5 +1,12 @@ #!/bin/bash - +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# mskalski@mirantis.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## RSYNC="rsync -4 --contimeout 5 --no-motd --list-only" # try to choose close ubuntu mirror which support rsync protocol @@ -11,6 +18,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 +41,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