Merge changes from topic 'remote-libvirt-support'
[fuel.git] / build / f_isoroot / f_repobuild / select_ubuntu_repo.sh
index 992359a..540f7eb 100755 (executable)
@@ -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,11 @@ RSYNC="rsync -4 --contimeout 5 --no-motd --list-only"
 # local mirror can be found after four attempts, the default archive
 # is returned instead.
 
+# Some Ubuntu mirrors seem less reliable for this type of mirroring -
+# as they are discoved they can be added to the blacklist below in order
+# for them not to be considered.
+BLACKLIST="mirrors.se.eu.kernel.org"
+
 return_url=0
 
 while [ "$1" != "" ]; do
@@ -23,13 +35,13 @@ while [ "$1" != "" ]; do
     shift
 done
 
-
 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)
+       echo ${BLACKLIST} | grep -q ${host} && continue
         if $RSYNC "${host}::ubuntu/." &> /dev/null
         then
             if ! $RSYNC "${host}::ubuntu/Archive-Update-in-Progress*" &> /dev/null