install-keycloak.sh: Modify script output: add explanatory comments.

This commit is contained in:
2026-04-05 01:24:21 +02:00
parent 27c82a9634
commit 7325ba80f5

View File

@@ -537,13 +537,13 @@ if [[ "$DB_TYPE" = "mysql" ]] ; then
echo "" echo ""
echo "Insert Database Credentials.." echo "Insert Database Credentials.."
echo "" echo ""
echo -e " A string containing credentials to establish a database connection. This character string 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 can consist of username and password, but also of login information stored in the file system
or the database itself. or the database itself.
Example: Example:
\033[33m-u root -p'<password>'\033[m \033[33m-u root -p'<password>'\033[m
\033[33m--login-path=local\033[m \033[33m--login-path=local\033[m
\033[33m--login-path=mysql-5.7\033[m \033[33m--login-path=mysql-5.7\033[m
@@ -800,6 +800,8 @@ if $nginx_installed ; then
else else
echo -e "\033[85G[ \033[1;31mNOT installed\033[m ]" 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 "" echo ""
echononl "\033[1mcontinue anyway\033[m [yes/no]: " echononl "\033[1mcontinue anyway\033[m [yes/no]: "
read OK read OK
@@ -827,6 +829,8 @@ else
echo -e "\033[85G[ \033[1;31mNOT installed\033[m ]" echo -e "\033[85G[ \033[1;31mNOT installed\033[m ]"
echo "" 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]: " echononl "\033[1mcontinue anyway\033[m [yes/no]: "
read OK read OK
while [[ "${OK,,}" != "yes" ]] && [[ "${OK,,}" != "no" ]] ; do while [[ "${OK,,}" != "yes" ]] && [[ "${OK,,}" != "no" ]] ; do
@@ -1390,7 +1394,7 @@ if [[ $? -ne 0 ]]; then
error "$(cat "$log_file")" error "$(cat "$log_file")"
else else
echo_ok echo_ok
fi fi
echononl "Backup original configuration file.." echononl "Backup original configuration file.."
mv "${KEYCLOAK_BASE_INSTALL_PATH}/keycloak/conf/keycloak.conf" \ mv "${KEYCLOAK_BASE_INSTALL_PATH}/keycloak/conf/keycloak.conf" \
@@ -1400,7 +1404,7 @@ if [[ $? -ne 0 ]]; then
error "$(cat "$log_file")" error "$(cat "$log_file")"
else else
echo_ok echo_ok
fi fi
echononl "Create new configuration .." echononl "Create new configuration .."
@@ -1461,7 +1465,7 @@ if [[ $? -ne 0 ]]; then
error "$(cat "$log_file")" error "$(cat "$log_file")"
else else
echo_ok echo_ok
fi fi
echo echo
@@ -1492,7 +1496,7 @@ EOF
error "$(cat "$log_file")" error "$(cat "$log_file")"
else else
echo_ok echo_ok
fi fi
else else
cat <<EOF > /etc/systemd/system/keycloak.service 2>"$log_file" cat <<EOF > /etc/systemd/system/keycloak.service 2>"$log_file"
[Unit] [Unit]
@@ -1516,7 +1520,7 @@ EOF
error "$(cat "$log_file")" error "$(cat "$log_file")"
else else
echo_ok echo_ok
fi fi
fi fi
@@ -1542,7 +1546,33 @@ blank_line
_certs_installed=false _certs_installed=false
echononl "Run script 'check_cert_for_keycloak.sh'.." echononl "Run script 'check_cert_for_keycloak.sh'.."
if [[ -x "/root/bin/monitoring/check_cert_for_keycloak.sh" ]] ; then 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 <<EOF
Create configuration file '/root/bin/monitoring/conf/(check_cert_for_keycloak.conf'
and set at least the 'service_domain', parameter, for example:
service_domain="${FQHN_HOSTNAME}"
Once you have done that, continue.
EOF
echo ""
echononl "\033[1mcontinue?\033[m [yes/no]: "
read OK
while [[ "${OK,,}" != "yes" ]] && [[ "${OK,,}" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
/root/bin/monitoring/check_cert_for_keycloak.sh > "$log_file" 2>&1 /root/bin/monitoring/check_cert_for_keycloak.sh > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo_failed echo_failed
@@ -1551,10 +1581,15 @@ if [[ -x "/root/bin/monitoring/check_cert_for_keycloak.sh" ]] ; then
echo_ok echo_ok
_certs_installed=true _certs_installed=true
fi fi
else else
warn "Certificate/Key for ${FQHN_HOSTNAME} cannot be provided." warn "Certificate/Key for ${FQHN_HOSTNAME} cannot be provided."
fi fi
echononl "Add a cronjob for checking cert.." echononl "Add a cronjob for checking cert.."
if [[ -f "$crontab_backup_file" ]]; then 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 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 if [[ $? -eq 0 ]]; then
echo_ok echo_ok
else else
echo_failed echo_failed
_admin_user_created=false _admin_user_created=false
error "$(cat $log_file)" error "$(cat $log_file)"
fi fi
else else
echo_skipped echo_skipped
fi fi
@@ -1912,10 +1947,10 @@ if ${_admin_user_created} ; then
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
echo_ok echo_ok
else else
echo_failed echo_failed
_admin_user_created=false _admin_user_created=false
error "$(cat $log_file)" error "$(cat $log_file)"
fi fi
else else
echo_skipped echo_skipped
fi fi
@@ -1932,14 +1967,14 @@ for _role in ${roles} ; do
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
echo_ok echo_ok
else else
echo_failed echo_failed
_admin_user_created=false _admin_user_created=false
error "$(cat $log_file)" error "$(cat $log_file)"
fi fi
else else
echo_skipped echo_skipped
fi fi
else else
echo_skipped echo_skipped
fi fi