Only add rhel base repos when REG_REPOS is not set

For offline (satellite based) installs the base repos won't be
available and the base packages will come from a different named repo
in satellite which will be specified by REG_REPOS.

This change will ensure no base repos are added when REG_REPOS are
specified so offline image builds are possible. All required base
repos need to be added to REG_REPOS when it is used. Documentation[1]
already includes base repos, so this should not be disruptive.

[1] https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.1/html/director_installation_and_usage/creating-whole-disk-images#disk-image-environment-variables

Change-Id: Iafb81d50dffdac40d3b011670200b8da4c3a58f0
This commit is contained in:
Steve Baker 2021-03-11 11:01:29 +13:00
parent 27a326dafb
commit 522113bc6c
2 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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