From: Frank Brehm Date: Mon, 16 Oct 2023 09:50:28 +0000 (+0200) Subject: Implementing RHEL registration X-Git-Tag: 1.8.0^2~38 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=35e8dd47d594dbc78ea3f42c3ee88aa701820f50;p=pixelpark%2Fcreate-terraform.git Implementing RHEL registration --- diff --git a/postinstall-scripts/functions.rc b/postinstall-scripts/functions.rc index 3141c19..c52b9b7 100644 --- a/postinstall-scripts/functions.rc +++ b/postinstall-scripts/functions.rc @@ -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}" diff --git a/postinstall-scripts/register-rhel b/postinstall-scripts/register-rhel index d49c1f8..09b40cc 100755 --- a/postinstall-scripts/register-rhel +++ b/postinstall-scripts/register-rhel @@ -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 }