Add support for Red Hat Satellite

A Red Hat Satellite URL may be provided as the source for
Red Hat packages. A Satellite key may be provided for a pre-
defined set of RHN channels to be automatically applied. Support
for installation of a Satellite certificate also provided.

Change-Id: Iae5b97d6f4732a28efa08ab778a56c2f9b6b6bd9
This commit is contained in:
aweiteka 2014-01-21 14:10:56 -05:00
parent ce14214a7a
commit bb04ff1ef2
2 changed files with 19 additions and 3 deletions

View File

@ -16,5 +16,6 @@ Certificate-based Red Hat Subscription Managment (RHSM) is the default registrat
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`.
* For RHN username/password authentication set DIB_RHSM_USER and DIB_RHSM_PASSWORD. To use a Satellite server activation key set DIB_SAT_KEY. If adding RHN channels username and password must be set.
* When registering to Satellite set DIB_SAT_URL to the Satellite server URL and DIB_SAT_CERT_RPM_URL to the Satellite certificate.
* 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`. RHN username/password is required for this.

View File

@ -4,7 +4,22 @@ set -e
if [ -n "$DIB_RHSM_USER" ] && [ -n "$DIB_RHSM_PASSWORD" ]
then
opts="--force --username ${DIB_RHSM_USER} --password ${DIB_RHSM_PASSWORD}"
opts="--force"
if [[ -n "$DIB_SAT_KEY" ]]; then
opts="$opts --activationkey ${DIB_SAT_KEY}"
else
opts="$opts --username ${DIB_RHSM_USER} --password ${DIB_RHSM_PASSWORD}"
fi
if [[ -n "$DIB_SAT_URL" ]]; then
if [[ "$DIB_REG_TYPE" == "rhn" ]]; then
opts="$opts --serverUrl ${DIB_SAT_URL}"
else
opts="$opts --serverurl ${DIB_SAT_URL} --sslCACert /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT"
fi
fi
if [[ -n "$DIB_SAT_CERT_RPM_URL" ]]; then
yum install -y ${DIB_SAT_CERT_RPM_URL}
fi
if [[ "$DIB_REG_TYPE" == "rhn" ]]; then
rhnreg_ks $opts --norhnsd
sleep 1