Make $DIB_YUM_REPO_CONF accept a list of repo files
It's useful to be able to pass in multiple yum repo configuration files via $DIB_YUM_REPO_CONF, not just a single one. Change-Id: I43722229a2df58be55bdb2b50c253e957b18e6fe
This commit is contained in:
		| @@ -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 | 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. | cache since the same rpm from different mirrors is often requested. | ||||||
|  |  | ||||||
| A custom yum repository configuration can also be applied by defining | Custom yum repository configurations can also be applied by defining | ||||||
| `DIB_YUM_REPO_CONF` to the path to a repo configuration file. The file will | `DIB_YUM_REPO_CONF` to a space separated list of repo configuration files. The | ||||||
| be copied to /etc/yum.repos.d/dib-yum-repo-conf.repo during the image build, | files will be copied to /etc/yum.repos.d/ during the image build, and then | ||||||
| and then removed at the end of the build. | 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 -eu | ||||||
| set -o pipefail | 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 | #!/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 | if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then | ||||||
|     set -x |     set -x | ||||||
| @@ -11,11 +11,17 @@ set -o pipefail | |||||||
| if [ -z "${DIB_YUM_REPO_CONF:-}" ] ; then | if [ -z "${DIB_YUM_REPO_CONF:-}" ] ; then | ||||||
|     echo "DIB_YUM_REPO_CONF is not set - no repo configuration will be copied in" |     echo "DIB_YUM_REPO_CONF is not set - no repo configuration will be copied in" | ||||||
|     exit 0 |     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 | fi | ||||||
|  |  | ||||||
| # copy the yum repo configuration | for file in $DIB_YUM_REPO_CONF; do | ||||||
| sudo cp -L -f $DIB_YUM_REPO_CONF $TMP_MOUNT_PATH/etc/yum.repos.d/dib-yum-repo-conf.repo |     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 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 James Slagle
					James Slagle