Add DIB_IPA_HARDWARE_RDO to define repo behaviour

Currently the latest RDO repo is installed on centos9
for the python-hardware package. This would not be appropriate in the
following cases:
* When repos are copied in from the host via DIB_YUM_REPO_CONF
* When another element is responsible for setting up repos

This change adds environment variable DIB_IPA_HARDWARE_RDO, which will
only be set to `1` on centos9, when DIB_YUM_REPO_CONF isn't set, and
when the user hasn't explicitly set DIB_IPA_HARDWARE_RDO.

This retains the current default behaviour of just working, while
giving flexibility for repos to be set up another way.

Change-Id: I1cc0b9833baf642866e9762c6bae44360bffe20d
This commit is contained in:
Steve Baker 2023-03-16 13:40:59 +13:00
parent 49367bc9d6
commit cb216b6cd8
3 changed files with 21 additions and 2 deletions

View File

@ -19,3 +19,5 @@ doing a source-based installation:
* ``DIB_IPA_HARDWARE_VERSION`` the version of the ``hardware`` package to
install when ``DIB_IPA_HARDWARE_PACKAGE`` is unset. If unset, the latest
version will be installed.
* ``DIB_IPA_HARDWARE_RDO`` set to ``0`` to prevent the latest RDO package repositories
being installed on CentOS-9-Stream (ignored when ``DIB_YUM_REPO_CONF`` is set).

View File

@ -0,0 +1,14 @@
if [[ "${DISTRO_NAME}${DIB_RELEASE}" =~ "centos9" ]]; then
if [ -n "${DIB_YUM_REPO_CONF:-}" ] ; then
# Always disable if DIB_YUM_REPO_CONF is defined
export DIB_IPA_HARDWARE_RDO=0
else
# Default to enabled, but overridable by the host
export DIB_IPA_HARDWARE_RDO=${DIB_IPA_HARDWARE_RDO:-1}
fi
else
# Always disable if not centos-9
export DIB_IPA_HARDWARE_RDO=0
fi

View File

@ -1,6 +1,9 @@
#!/bin/bash
# It enables RDO deps repo for CentOS Stream 9
# It enables RDO deps repo when DIB_IPA_HARDWARE_RDO=1
if [[ "${DISTRO_NAME}${DIB_RELEASE}" =~ "centos9" ]]; then
set -eux
set -o pipefail
if [ ${DIB_IPA_HARDWARE_RDO:-0} -ne 0 ]; then
curl -o /etc/yum.repos.d/dlrn-deps.repo https://trunk.rdoproject.org/centos9-master/dlrn-deps.repo
fi