uprgade-keycloak.sh: some minor changes..

This commit is contained in:
Christoph 2025-03-18 16:08:41 +01:00
parent f3676c92af
commit 1b356ebce1
2 changed files with 56 additions and 17 deletions

View File

@ -1369,7 +1369,7 @@ blank_line
echononl "Backup Keycloak Installation directory.." echononl "Backup Keycloak Installation directory.."
if [[ -n "${OLD_INSTALL_DIR}" ]]; then if [[ -n "${OLD_INSTALL_DIR}" ]]; then
cp -a "${OLD_INSTALL_DIR}" "${OLD_INSTALL_DIR}.${backup_date}" > "$log_file" 2>&1 mv "${OLD_INSTALL_DIR}" "${OLD_INSTALL_DIR}.${backup_date}" > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo_failed echo_failed
error "$(cat "$log_file")" error "$(cat "$log_file")"
@ -1381,6 +1381,7 @@ else
fi fi
echononl "Remove Symlink '${KEYCLOAK_BASE_INSTALL_PATH}/keycloak' .." echononl "Remove Symlink '${KEYCLOAK_BASE_INSTALL_PATH}/keycloak' .."
if [[ -h "${KEYCLOAK_BASE_INSTALL_PATH}/keycloak" ]] ; then
rm "${KEYCLOAK_BASE_INSTALL_PATH}/keycloak" > "$log_file" 2>&1 rm "${KEYCLOAK_BASE_INSTALL_PATH}/keycloak" > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo_failed echo_failed
@ -1388,6 +1389,9 @@ if [[ $? -ne 0 ]]; then
else else
echo_ok echo_ok
fi fi
else
echo_skipped
fi
blank_line blank_line

View File

@ -579,7 +579,7 @@ blank_line
echononl "Backup Keycloak Installation directory.." echononl "Backup Keycloak Installation directory.."
if [[ -n "${CUR_INSTALL_DIR}" ]]; then if [[ -n "${CUR_INSTALL_DIR}" ]]; then
cp -a "${CUR_INSTALL_DIR}" "${CUR_INSTALL_DIR}.${backup_date}" > "$log_file" 2>&1 mv "${CUR_INSTALL_DIR}" "${CUR_INSTALL_DIR}.${backup_date}" > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo_failed echo_failed
error "$(cat "$log_file")" error "$(cat "$log_file")"
@ -615,7 +615,7 @@ fi
blank_line blank_line
echononl "Copy 'conf/ directory from the previous installation to the new installation." echononl "Copy 'conf/ directory from the previous installation to the new installation."
cp -a "${CUR_INSTALL_DIR}/conf" "${KEYCLOAK_INSTALL_DIR}/" > "$log_file" 2>&1 cp -a "${CUR_INSTALL_DIR}.${backup_date}/conf" "${KEYCLOAK_INSTALL_DIR}/" > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo_failed echo_failed
error "$(cat "$log_file")" error "$(cat "$log_file")"
@ -624,7 +624,7 @@ else
fi fi
echononl "Copy 'providers/ directory from the previous installation to the new installation." echononl "Copy 'providers/ directory from the previous installation to the new installation."
cp -a "${CUR_INSTALL_DIR}/providers" "${KEYCLOAK_INSTALL_DIR}/" > "$log_file" 2>&1 cp -a "${CUR_INSTALL_DIR}.${backup_date}/providers" "${KEYCLOAK_INSTALL_DIR}/" > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo_failed echo_failed
error "$(cat "$log_file")" error "$(cat "$log_file")"
@ -633,7 +633,7 @@ else
fi fi
echononl "Copy 'themes/ directory from the previous installation to the new installation." echononl "Copy 'themes/ directory from the previous installation to the new installation."
cp -a "${CUR_INSTALL_DIR}/themes" "${KEYCLOAK_INSTALL_DIR}/" > "$log_file" 2>&1 cp -a "${CUR_INSTALL_DIR}.${backup_date}/themes" "${KEYCLOAK_INSTALL_DIR}/" > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo_failed echo_failed
error "$(cat "$log_file")" error "$(cat "$log_file")"
@ -750,6 +750,8 @@ if [[ $? -ne 0 ]]; then
echo_failed echo_failed
error "$(cat "$log_file")" error "$(cat "$log_file")"
if $terminal ; then
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
@ -758,6 +760,19 @@ if [[ $? -ne 0 ]]; then
done done
[[ $OK = "yes" ]] || fatal "Abbruch durch User" [[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
else
echo_ok
fi
echononl "Wait 20 seconds for the keycloak service to be fully created."
echo_wait
sleep 20
${KEYCLOAK_BASE_INSTALL_PATH}/keycloak/bin/kc.sh show-config > "${working_dir}/current-configuration.txt" 2> "$log_file"
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else else
echo_ok echo_ok
fi fi
@ -769,6 +784,26 @@ systemctl start keycloak.service > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo_failed echo_failed
error "$(cat "$log_file")" error "$(cat "$log_file")"
if $terminal ; then
echo " Perhaps it is enough to wait a moment and then start the:"
echo ""
echo " The command to start the keycloak service is:"
echo ""
echo -e " \033[33msystemctl start keycloak.service\033[m"
echo ""
echononl "\033[1mcontinue anyway\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
else else
echo_ok echo_ok
fi fi