Support list of Red Hat channels and repos

When registering to RHN or RHSM a list of space-separated
channels or repositories may be provided. This allows control
over which packages are available to the system during build.
Note, the optional channel or repository is added by default
since diskimage-builder requires access to its packages. This
list is for additional channels or repos.

Change-Id: I9cf90d47ab1d09f5491f574132410438f9e294e3
This commit is contained in:
aweiteka 2014-01-21 13:53:36 -05:00
parent 78dbbe68fe
commit ce14214a7a
2 changed files with 12 additions and 0 deletions

View File

@ -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_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_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) ## 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. 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. * 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`.

View File

@ -10,6 +10,11 @@ if [ -n "$DIB_RHSM_USER" ] && [ -n "$DIB_RHSM_PASSWORD" ]
sleep 1 sleep 1
# optional channel required for diskimage-builder dependency # optional channel required for diskimage-builder dependency
channels="-a -c rhel-x86_64-server-optional-6" 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 --user=$DIB_RHSM_USER --password=$DIB_RHSM_PASSWORD $channels
rhn-channel -l rhn-channel -l
else else
@ -23,6 +28,11 @@ if [ -n "$DIB_RHSM_USER" ] && [ -n "$DIB_RHSM_PASSWORD" ]
fi fi
# optional repo required for diskimage-builder dependency # optional repo required for diskimage-builder dependency
repos="--enable rhel-6-server-optional-rpms" 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 $repos
subscription-manager repos --list subscription-manager repos --list
fi fi