aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorStefan K. Berg <stefan.k.berg@ericsson.com>2016-10-11 12:33:08 +0200
committerStefan K. Berg <stefan.k.berg@ericsson.com>2016-10-11 12:33:08 +0200
commit32160e9a615bd8c5024e0732da11bd9fa6c78504 (patch)
tree2248f1e8a93d7475ccf83e07b8b63218563de48f /build
parentaa912dc6691fba23c0827108f6a20296942e1ac0 (diff)
Re-introduce mirror blacklisting
Some mirrors are misbehaving, for instance due to flood protection, which makes them unreliable. This change re-introduces the possibility to blacklist them locally. Change-Id: I7840ac0a622f2997395e54911685f9eea393dee4 Signed-off-by: Stefan K. Berg <stefan.k.berg@ericsson.com>
Diffstat (limited to 'build')
-rwxr-xr-xbuild/f_isoroot/f_repobuild/select_ubuntu_repo.sh26
1 files changed, 23 insertions, 3 deletions
diff --git a/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh b/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh
index 10a841171..24bd42234 100755
--- a/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh
+++ b/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh
@@ -1,4 +1,8 @@
#!/bin/bash
+
+BLACKLIST="http://mirrors.se.eu.kernel.org/ubuntu/"
+#BLACKLIST+=" http://foo.bar"
+
cleanup() {
rm -f $TMPFILE
}
@@ -7,6 +11,19 @@ debugmsg() {
test -n "$DEBUG" && echo "$@" >&2
}
+
+# Check if url is blacklisted in this script
+blacklisted () {
+ for blackurl in $BLACKLIST
+ do
+ if [ "$1" == "$blackurl" ]; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+
# Check mirror's integrity
check_mirror () {
mirror=$1
@@ -57,7 +74,7 @@ DEBUG=1
TMPFILE=$(mktemp /tmp/mirrorsXXXXX)A
trap cleanup exit
-# Generated a list of mirrors considered as "up"
+# Generate a list of mirrors considered as "up"
curl -s https://launchpad.net/ubuntu/+archivemirrors | \
grep -P -B8 "statusUP|statusSIX" | \
grep -o -P "(f|ht)tp.*\"" | \
@@ -67,8 +84,11 @@ curl -s https://launchpad.net/ubuntu/+archivemirrors | \
# and sane.
for url in $(curl -s http://mirrors.ubuntu.com/mirrors.txt)
do
- grep -q $url $TMPFILE || debugmsg "$url Faulty (detected by Ubuntu)"
- if [ -z $BESTURL ]; then
+ if ! grep -q $url $TMPFILE; then
+ debugmsg "$url Faulty (detected by Ubuntu)"
+ elif blacklisted $url; then
+ debugmsg "$url blacklisted"
+ elif [ -z $BESTURL ]; then
if grep -q $url $TMPFILE && check_mirror $url; then
debugmsg "$url: OK (setting as primary URL)"
BESTURL=$url