diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2020-08-19 10:25:48 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2020-08-19 10:25:48 +0200 |
commit | e99fccf4c741025bf6353b96635ad9690e250bf7 (patch) | |
tree | 04e9a44fe5cdbf6b164413e63c8a16b006fa90f0 /configure-mirror | |
parent | 2a6881e32fd4484d1b0bbbe03d73a479e0dc9251 (diff) | |
download | podman-docker-builder-e99fccf4c741025bf6353b96635ad9690e250bf7.tar.gz |
add configure-mirror
Diffstat (limited to 'configure-mirror')
-rwxr-xr-x | configure-mirror | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/configure-mirror b/configure-mirror new file mode 100755 index 0000000..1b7ba55 --- /dev/null +++ b/configure-mirror @@ -0,0 +1,37 @@ +#!/bin/sh + +function set_baseurl() { + local furl="$1" + local turl="$2" + local name="$3" + local file + + if test "$turl" = ""; then + echo "# no mirror: $furl (env \$$name)" + return + fi + + for file in /etc/yum.repos.d/*.repo; do + grep -q -e "baseurl=$furl" || continue + echo "# mirror: $furl -> $turl ($file)" + sed -i.orig \ + -e 's/^mirrorlist/#mirrorlist/' \ + -e 's/^#baseurl/baseurl/' \ + -e "s|baseurl=${furl}|baseurl=${turl}|" \ + "$file" + diff "${file}.orig" "$file" + done +} + +# +# use fixed (configurable) mirror. +# be cache proxy friendly. +# +set_baseurl http://mirror.centos.org/ "${CENTOS_MIRROR}" CENTOS_MIRROR +set_baseurl http://download.fedoraproject.org/ "${FEDORA_MIRROR}" FEDORA_MIRROR + +# +# no parallel downloads please. +# +grep -q max_parallel_downloads /etc/dnf/dnf.conf ||\ +echo max_parallel_downloads=1 >> /etc/dnf/dnf.conf |