]> Frank Brehm's Git Trees - pixelpark/create-terraform.git/commitdiff
Implementing RHEL registration
authorFrank Brehm <frank.brehm@pixelpark.com>
Mon, 16 Oct 2023 09:50:28 +0000 (11:50 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Mon, 16 Oct 2023 09:50:28 +0000 (11:50 +0200)
postinstall-scripts/functions.rc
postinstall-scripts/register-rhel

index 3141c19645fb11a30996e972c98357259a8e2990..c52b9b79d56d4797e81bb13c5fbf7c853964666c 100644 (file)
@@ -161,9 +161,9 @@ eval_common_options() {
 
     if [[ "${VERBOSE}" == "y" && "${QUIET}" == "y" ]] ; then
         error "Parameters '${RED}--verbose${NORMAL}' and '${RED}--quiet${NORMAL}' are mutually exclusive."
-        echo
+        empty_line
         usage >&2
-        echo
+        empty_line
         exit 1
     fi
 
@@ -174,10 +174,10 @@ eval_common_options() {
                            ${CYAN}#${NORMAL}       ${YELLOW}Simulation mode${NORMAL}       ${CYAN}#${NORMAL}
                            ${CYAN}#${NORMAL} Nothing will be really done ${CYAN}#${NORMAL}
                            ${CYAN}###############################${NORMAL}
-
                        EOF
         )
         echo -e "${msg}"
+        empty_line
     fi
 
 }
@@ -453,6 +453,7 @@ set_locale() {
     if [[ "${found}" != "y" ]] ; then
         error "Locale '${RED}${new_locale}${NORMAL}' not found."
     else
+        debug "Setting localization to '${CYAN}${new_locale}${NORMAL}' ..."
         LANG="${new_locale}"
         LC_ALL=
         LC_CTYPE="${new_locale}"
index d49c1f866f0413c99bc6f069cc16a924948c733c..09b40cc4097d52798d790b15f12867c438e846dd 100755 (executable)
@@ -122,6 +122,21 @@ get_options() {
 
 }
 
+#------------------------------------------------------------------------------
+register_rhel() {
+
+    local fqdn=$( hostname -f )
+    local -a cmd=( "${SM_BIN}" 'register' )
+    cmd+=( '--name' "${fqdn}" )
+    cmd+=( '--username' "'${RHSM_USER}'" )
+    cmd+=( '--password' "'${RHSM_PWD}'" )
+    cmd+=( '--auto-attach' '--force' )
+    cmd+=( '--no-progress-messages' )
+
+    exec_cmd "${cmd[@]}"
+
+}
+
 ################################################################################
 ##
 ## Main
@@ -132,8 +147,9 @@ get_options() {
 main() {
 
     get_options "$@"
+    set_locale "en_US.utf8"
     check_for_root
-    register_rhel
+    register_rhel
     # mangle_repos
 
 }