diff --git a/diskimage_builder/elements/rhel-common/README.rst b/diskimage_builder/elements/rhel-common/README.rst index 7c640109..db8ab149 100644 --- a/diskimage_builder/elements/rhel-common/README.rst +++ b/diskimage_builder/elements/rhel-common/README.rst @@ -104,6 +104,8 @@ A single string representing a list of repository names separated by a comma (No spaces). Each of the repositories in this string are enabled through subscription manager. Once you've attached a subscription, you can find available repositories by running subscription-manager repos --list. +No base repos will be added when REG_REPOS is set, so these must be included +in REG_REPOS. #### REG\_SERVER\_URL Gives the hostname of the subscription service to use. The default is diff --git a/diskimage_builder/elements/rhel-common/pre-install.d/00-rhel-registration b/diskimage_builder/elements/rhel-common/pre-install.d/00-rhel-registration index 7935c72d..91e6d38d 100755 --- a/diskimage_builder/elements/rhel-common/pre-install.d/00-rhel-registration +++ b/diskimage_builder/elements/rhel-common/pre-install.d/00-rhel-registration @@ -10,15 +10,17 @@ set -o pipefail opts= attach_opts= arch=$(uname -m) +repos="repos " +base_repos= if [ "${DIB_RELEASE:-7}" == "7" ]; then - repos="repos --enable rhel-7-server-rpms" + base_repos="rhel-7-server-rpms" satellite_repo="rhel-7-server-rh-common-rpms" elif [ "${DIB_RELEASE}" == "8" ]; then if [ -n "${REG_RELEASE:-}" ]; then - repos="repos --enable rhel-8-for-${arch}-appstream-eus-rpms --enable rhel-8-for-${arch}-baseos-eus-rpms" + base_repos="rhel-8-for-${arch}-appstream-eus-rpms rhel-8-for-${arch}-baseos-eus-rpms" else - repos="repos --enable rhel-8-for-${arch}-appstream-rpms --enable rhel-8-for-${arch}-baseos-rpms" + base_repos="rhel-8-for-${arch}-appstream-rpms rhel-8-for-${arch}-baseos-rpms" fi satellite_repo="satellite-tools-6.5-for-rhel-8-${arch}-rpms" fi @@ -93,6 +95,10 @@ if [ -n "${REG_REPOS:-}" ]; then for repo in $(echo $REG_REPOS | tr ',' '\n'); do repos="$repos --enable $repo" done +else + for repo in $base_repos; do + repos="$repos --enable $repo" + done fi if [ -n "${REG_TYPE:-}" ]; then