Merge "Allow injecting arbitrary yum repo configuration"

This commit is contained in:
Jenkins 2014-12-09 18:56:08 +00:00 committed by Gerrit Code Review
commit b74bb649e2
3 changed files with 29 additions and 0 deletions

View File

@ -8,3 +8,8 @@ chroot so that they can be reused by subsequent image builds. The cache
increases image building speed when building multiple images, especially on
slow connections. This is more effective than using an HTTP proxy as a yum
cache since the same rpm from different mirrors is often requested.
A custom yum repository configuration can also be applied by defining
`DIB_YUM_REPO_CONF` to the path to a repo configuration file. The file will
be copied to /etc/yum.repos.d/dib-yum-repo-conf.repo during the image build,
and then removed at the end of the build.

View File

@ -0,0 +1,6 @@
#!/bin/bash
set -eux
set -o pipefail
sudo rm -f $TMP_MOUNT_PATH/etc/yum.repos.d/dib-yum-repo-conf.repo

View File

@ -0,0 +1,18 @@
#!/bin/bash
# Add an additional yum repo configuration with $DIB_YUM_REPO_CONF
set -eux
set -o pipefail
# exit directly if DIB_YUM_REPO_CONF is not defined properly
if [ -z "${DIB_YUM_REPO_CONF:-}" ] ; then
echo "DIB_YUM_REPO_CONF is not set - no repo configuration will be copied in"
exit 0
elif [ ! -f "$DIB_YUM_REPO_CONF" ] ; then
echo "DIB_YUM_REPO_CONF is not a valid yum repo configuration file."
echo "You should assign a proper yum repo configuration file in DIB_YUM_REPO_CONF"
exit 1
fi
# copy the yum repo configuration
sudo cp -L -f $DIB_YUM_REPO_CONF $TMP_MOUNT_PATH/etc/yum.repos.d/dib-yum-repo-conf.repo