From 7325ba80f57bf31667cdb193e0604d29889c682d Mon Sep 17 00:00:00 2001 From: Christoph Date: Sun, 5 Apr 2026 01:24:21 +0200 Subject: [PATCH] install-keycloak.sh: Modify script output: add explanatory comments. --- install-keycloak.sh | 71 +++++++++++++++++++++++++++++++++------------ 1 file changed, 53 insertions(+), 18 deletions(-) diff --git a/install-keycloak.sh b/install-keycloak.sh index 66905e8..1fa0751 100755 --- a/install-keycloak.sh +++ b/install-keycloak.sh @@ -537,13 +537,13 @@ if [[ "$DB_TYPE" = "mysql" ]] ; then echo "" echo "Insert Database Credentials.." echo "" - - echo -e " A string containing credentials to establish a database connection. This character string - can consist of username and password, but also of login information stored in the file system + + echo -e " A string containing credentials to establish a database connection. This character string + can consist of username and password, but also of login information stored in the file system or the database itself. - - Example: - + + Example: + \033[33m-u root -p''\033[m \033[33m--login-path=local\033[m \033[33m--login-path=mysql-5.7\033[m @@ -800,6 +800,8 @@ if $nginx_installed ; then else echo -e "\033[85G[ \033[1;31mNOT installed\033[m ]" + echo "" + echo -e " \033[33mYou might want to install \033[1mnginx\033[m\033[33m and continue\033[m" echo "" echononl "\033[1mcontinue anyway\033[m [yes/no]: " read OK @@ -827,6 +829,8 @@ else echo -e "\033[85G[ \033[1;31mNOT installed\033[m ]" echo "" + echo "" + echo -e " \033[33mYou might want to install \033[1mdefault-jdk\033[m\033[33m and continue\033[m" echononl "\033[1mcontinue anyway\033[m [yes/no]: " read OK while [[ "${OK,,}" != "yes" ]] && [[ "${OK,,}" != "no" ]] ; do @@ -1390,7 +1394,7 @@ if [[ $? -ne 0 ]]; then error "$(cat "$log_file")" else echo_ok -fi +fi echononl "Backup original configuration file.." mv "${KEYCLOAK_BASE_INSTALL_PATH}/keycloak/conf/keycloak.conf" \ @@ -1400,7 +1404,7 @@ if [[ $? -ne 0 ]]; then error "$(cat "$log_file")" else echo_ok -fi +fi echononl "Create new configuration .." @@ -1461,7 +1465,7 @@ if [[ $? -ne 0 ]]; then error "$(cat "$log_file")" else echo_ok -fi +fi echo @@ -1492,7 +1496,7 @@ EOF error "$(cat "$log_file")" else echo_ok - fi + fi else cat < /etc/systemd/system/keycloak.service 2>"$log_file" [Unit] @@ -1516,7 +1520,7 @@ EOF error "$(cat "$log_file")" else echo_ok - fi + fi fi @@ -1542,7 +1546,33 @@ blank_line _certs_installed=false echononl "Run script 'check_cert_for_keycloak.sh'.." + if [[ -x "/root/bin/monitoring/check_cert_for_keycloak.sh" ]] ; then + + if [[ ! -f "/root/bin/monitoring/conf/check_cert_for_keycloak.conf" ]] ; then + echo_skipped + + cat < "$log_file" 2>&1 if [[ $? -ne 0 ]]; then echo_failed @@ -1551,10 +1581,15 @@ if [[ -x "/root/bin/monitoring/check_cert_for_keycloak.sh" ]] ; then echo_ok _certs_installed=true fi + else warn "Certificate/Key for ${FQHN_HOSTNAME} cannot be provided." fi + + + + echononl "Add a cronjob for checking cert.." if [[ -f "$crontab_backup_file" ]]; then if ! grep -iq -E "/root/bin/monitoring/check_cert_for_keycloak.sh" "$crontab_backup_file" > /dev/null 2>&1; then @@ -1897,10 +1932,10 @@ if ${_admin_user_created} ; then if [[ $? -eq 0 ]]; then echo_ok else - echo_failed + echo_failed _admin_user_created=false error "$(cat $log_file)" - fi + fi else echo_skipped fi @@ -1912,10 +1947,10 @@ if ${_admin_user_created} ; then if [[ $? -eq 0 ]]; then echo_ok else - echo_failed + echo_failed _admin_user_created=false error "$(cat $log_file)" - fi + fi else echo_skipped fi @@ -1932,14 +1967,14 @@ for _role in ${roles} ; do if [[ $? -eq 0 ]]; then echo_ok else - echo_failed + echo_failed _admin_user_created=false error "$(cat $log_file)" - fi + fi else echo_skipped fi - + else echo_skipped fi