Merge "Refactoring"
[fuel.git] / build / f_isoroot / f_repobuild / select_ubuntu_repo.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2015,2016 Ericsson AB and others.
4 # mskalski@mirantis.com
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 # Try to choose close ubuntu mirror from mirrors.txt, but "whitewash" this
12 # against the full repo list to removed mirrors not up-to-date.
13
14 # Some Ubuntu mirrors seem less reliable for this type of mirroring -
15 # as they are discoved they can be added to the blacklist below in order
16 # for them not to be considered.
17 BLACKLIST="mirror.clibre.uqam.ca"
18
19 #NOTE: For now the mirror selection is disabled due to issues not yet
20 #      understood/resolved.
21 #for url in $((curl -s  https://launchpad.net/ubuntu/+archivemirrors | \
22 #              grep -P -B8 "statusUP|statusSIX" | \
23 #              grep -o -P "(f|ht)tp.*\""  | \
24 #              sed 's/"$//' | sort | uniq; \
25 #              curl -s http://mirrors.ubuntu.com/mirrors.txt | sort | uniq) | \
26 #              sort | uniq -d)
27 #do
28 #    host=$(echo $url | cut -d'/' -f3)
29 #    echo ${BLACKLIST} | grep -q ${host} && continue
30 #    if curl -s -o /dev/null --head --fail "$url"; then
31 #      echo $url
32 #      exit 0
33 #    else
34 #      continue
35 #    fi
36 #done
37
38 # If no suitable local mirror can be found,
39 # the default archive is returned instead.
40 echo "http://archive.ubuntu.com/ubuntu/"