Differences
This shows you the differences between two versions of the page.
linux_wiki:rhnreg_fix [2015/12/30 17:32] billdozor created |
linux_wiki:rhnreg_fix [2019/05/25 23:50] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Rhnreg Fix ====== | ||
- | |||
- | **General Information** | ||
- | |||
- | Fix a system that is not registered to Spacewalk and can't be registered because it doesn' | ||
- | |||
- | **Checklist** | ||
- | * Enterprise Linux 6/7 | ||
- | * Spacewalk Server | ||
- | |||
- | ---- | ||
- | |||
- | ====== The Script ====== | ||
- | |||
- | <code bash fix_rhnreg.sh> | ||
- | #!/bin/bash | ||
- | |||
- | ## Title: fix_rhnreg | ||
- | ## Description: | ||
- | ## Author: Bill Howe | ||
- | ## Date: 2015-12-30 | ||
- | ## Recent Changes: Cleaned up echo formatting | ||
- | |||
- | #### CUSTOMIZE HERE ##### | ||
- | #Spacewalk server fqdn | ||
- | sw_server=" | ||
- | |||
- | #### END OF CUSTOMIZE ##### | ||
- | |||
- | echo "=== Install Missing Packages for rhnreg_ks ===" | ||
- | echo "This script checks for the existence of rhnreg_ks." | ||
- | echo "If it does not exist, it will download and install" | ||
- | echo " | ||
- | |||
- | echo -e " | ||
- | if [[ $(which rhnreg_ks) ]];then | ||
- | echo "=> rhnreg_ks exists, nothing needs fixing." | ||
- | exit 0 | ||
- | else | ||
- | echo "=> rhnreg_ks not found! Will attempt to fix." | ||
- | fi | ||
- | |||
- | echo -e " | ||
- | mkdir / | ||
- | cd / | ||
- | |||
- | echo -e " | ||
- | |||
- | # Distro version check | ||
- | major_version=$(awk -F: ' | ||
- | |||
- | case $major_version in | ||
- | 6) | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | ;; | ||
- | |||
- | 7) | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | wget --no-check-certificate https:// | ||
- | ;; | ||
- | esac | ||
- | |||
- | echo -e " | ||
- | yum -y install ./*.rpm | ||
- | |||
- | # Go back to original directory | ||
- | cd - | ||
- | |||
- | echo -e " | ||
- | rm -rf / | ||
- | |||
- | echo -e " | ||
- | if [[ $(which rhnreg_ks) ]];then | ||
- | echo "=> rhnreg_ks now exists, issue should be fixed!" | ||
- | exit 0 | ||
- | else | ||
- | echo "=> rhnreg_ks does not exist, something must have gone wrong..." | ||
- | exit 1 | ||
- | fi | ||
- | </ | ||
- | |||
- | ---- | ||