Created
November 19, 2013 15:23
-
-
Save stovak/7546992 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ $PLATFORM_NAME == "Redhat" ]]; then | |
display_header " | |
In order to a redhat install, we must download RPMs directly from RedHat. In order to do that, we must first register this system with redhat. | |
This requires a subscription to the RedHat network. | |
" | |
question "Please enter your redhat subscription username (not email address):" REDHAT_USERNAME String | |
question "please enter your redhat subscription password" REDHAT_PASSWORD String | |
display_step "Validating/Estabishing connection" | |
# If rhn_check comes back w/error, the system is not registered. | |
if [ ! -f /etc/sysconfig/rhn/systemid ] ; then | |
subscription-manager register --username=$REDHAT_USERNAME --password=$REDHAT_PASSWORD --auto-attach | |
if [ ! -f /etc/sysconfig/rhn/systemid ]; then | |
display_error "Unable to register with the redhat network" | |
exit 1 | |
fi | |
else | |
display "System is registered on RHN." | |
fi | |
# Make sure the RHN server-optional channel is registered | |
if [[ `rhn-channel -l | grep -c 'server-optional'` -eq 1 ]] ; then | |
display "System is registered to RHN channel server-optional." | |
else | |
export CHANNEL=`rhn-channel -L -u $REDHAT_USERNAME -p$REDHAT_PASSWORD | grep server-optional` | |
rhn-channel --add --channel=$CHANNEL --user=$REDHAT_USERNAME --password=$REDHAT_PASSWORD | |
if [[ `rhn-channel -l | grep -c 'server-optional'` -ne 1 ]] ; then | |
display_error "Unable to add the server-optional channel to this machine." | |
exit 1 | |
fi | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment