Merge "Make $DIB_YUM_REPO_CONF accept a list of repo files"
This commit is contained in:
commit
934608cad6
@ -12,7 +12,8 @@ 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.
|
||||
Custom yum repository configurations can also be applied by defining
|
||||
`DIB_YUM_REPO_CONF` to a space separated list of repo configuration files. The
|
||||
files will be copied to /etc/yum.repos.d/ during the image build, and then
|
||||
removed at the end of the build. Each repo file should be named differently to
|
||||
avoid a filename collision.
|
||||
|
@ -6,4 +6,12 @@ fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
sudo rm -f $TMP_MOUNT_PATH/etc/yum.repos.d/dib-yum-repo-conf.repo
|
||||
# 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 configurations will be cleaned up"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for file in $DIB_YUM_REPO_CONF; do
|
||||
sudo rm -f $TMP_MOUNT_PATH/etc/yum.repos.d/$(basename $file)
|
||||
done
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Add an additional yum repo configuration with $DIB_YUM_REPO_CONF
|
||||
# Add additional yum repo configuration(s) with $DIB_YUM_REPO_CONF
|
||||
|
||||
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
|
||||
set -x
|
||||
@ -11,11 +11,17 @@ set -o pipefail
|
||||
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
|
||||
for file in $DIB_YUM_REPO_CONF; do
|
||||
if [ ! -f $file ]; then
|
||||
echo "$file is not a valid yum repo configuration file."
|
||||
echo "You should assign a list of proper yum repo configuration"
|
||||
echo "files in DIB_YUM_REPO_CONF."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# copy the yum repo configuration
|
||||
sudo cp -L -f $file $TMP_MOUNT_PATH/etc/yum.repos.d
|
||||
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user