Fedora: Add support for configuring Yum mirrors
Updates the fedora element so that DIB_DISTRIBUTION_MIRROR can be used to configure a custom Yum mirror on Fedora. This implementation replaces the baseurl in each of the default Fedora Yum .repo files so that a custom mirror URL/path can be supplied. The URL should point to the directory where the updates and release directories exist. Example: http://download.fedoraproject.org/pub/fedora/linux As part of this change we also remove any existing metalink settings in the .repo files to cover the case where an end user runs their own createrepo command to create the mirror... which means your metadata won't match that of the normal Fedora mirrors and your baseurl won't get used. Change-Id: I1a49a2941b1cc489e91a72b87430393cd32e865d
This commit is contained in:
parent
928e6f237b
commit
131fb6e4db
2 changed files with 19 additions and 0 deletions
|
@ -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.
|
||||
|
|
11
elements/fedora/pre-install.d/01-set-fedora-mirror
Executable file
11
elements/fedora/pre-install.d/01-set-fedora-mirror
Executable file
|
@ -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
|
Loading…
Reference in a new issue