diff --git a/elements/rhel/README.md b/elements/rhel/README.md index efa9a254..b7b64a52 100644 --- a/elements/rhel/README.md +++ b/elements/rhel/README.md @@ -10,9 +10,11 @@ Certificate-based Red Hat Subscription Managment (RHSM) is the default registrat * Set DIB_RHSM_USER and DIB_RHSM_PASSWORD to register the system with RHSM during the image building process. This will apply the associated Red Hat Enterprise Linux Server subscription so the latest package updates can be applied. At the end of the image building process, the system will be unregistered from RHSM. * Set DIB_RHSM_POOL to a subscription pool if you do not want the system to use the `--auto-attach` feature of `subscription-manager`. +* Set DIB_RHSM_REPOS to a space-separated list of Red Hat repositories to enable. ## Red Hat Network (RHN) Set `DIB_REG_TYPE=rhn` for Red Hat Network (RHN classic) registration. The image building process will register the system to RHN and apply the associated Red Hat Enterprise Linux Server subscription so the latest package updates can be applied. At the end of the image building process, the system will be unregistered from RHN. * For RHN username/password authentication set DIB_RHSM_USER and DIB_RHSM_PASSWORD. +* Set DIB_RHN_CHANNELS to a space-separated list of RHN channels to add. Example: `DIB_RHN_CHANNELS=rhel-x86_64-server-6 rhel-x86_64-server-6-rhscl-1`. diff --git a/elements/rhel/pre-install.d/00-rhsm b/elements/rhel/pre-install.d/00-rhsm index 75f928a2..9c4438f2 100755 --- a/elements/rhel/pre-install.d/00-rhsm +++ b/elements/rhel/pre-install.d/00-rhsm @@ -10,6 +10,11 @@ if [ -n "$DIB_RHSM_USER" ] && [ -n "$DIB_RHSM_PASSWORD" ] sleep 1 # optional channel required for diskimage-builder dependency channels="-a -c rhel-x86_64-server-optional-6" + if [[ -n "$DIB_RHN_CHANNELS" ]]; then + for chan in $DIB_RHN_CHANNELS; do + channels="$channels -a -c $chan" + done + fi rhn-channel --user=$DIB_RHSM_USER --password=$DIB_RHSM_PASSWORD $channels rhn-channel -l else @@ -23,6 +28,11 @@ if [ -n "$DIB_RHSM_USER" ] && [ -n "$DIB_RHSM_PASSWORD" ] fi # optional repo required for diskimage-builder dependency repos="--enable rhel-6-server-optional-rpms" + if [[ -n "$DIB_RHSM_REPOS" ]]; then + for repo in $DIB_RHSM_REPOS; do + repos="$repos --enable $repo" + done + fi subscription-manager repos $repos subscription-manager repos --list fi