diff --git a/elements/fedora/README.md b/elements/fedora/README.md index c31621ff..97003091 100644 --- a/elements/fedora/README.md +++ b/elements/fedora/README.md @@ -1,3 +1,11 @@ Use Fedora cloud images as the baseline for built disk images. +If you wish to use a Fedora Yum mirror you can set DIB\_DISTRIBUTION\_MIRROR +before running bin/disk-image-create. Example: + + DIB\_DISTRIBUTION\_MIRROR=http://download.fedoraproject.org/pub/fedora/linux + +This URL should point to the directory containing the releases/updates/ +development/and extras directories. + For further details see the redhat-common README. diff --git a/elements/fedora/pre-install.d/01-set-fedora-mirror b/elements/fedora/pre-install.d/01-set-fedora-mirror new file mode 100755 index 00000000..a80236a9 --- /dev/null +++ b/elements/fedora/pre-install.d/01-set-fedora-mirror @@ -0,0 +1,11 @@ +#!/bin/bash + +set -eu + +DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-} + +[ -n "$DIB_DISTRIBUTION_MIRROR" ] || exit 0 + +for FILE in /etc/yum.repos.d/fedora.repo /etc/yum.repos.d/fedora-updates.repo /etc/yum.repos.d/fedora-updates-testing.repo; do + sudo sed -e "s|^#baseurl=http://download.fedoraproject.org/pub/fedora/linux|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^metalink/d" -i $FILE +done