diff --git a/install-keycloak.sh b/install-keycloak.sh index ac3242c..1d78c25 100755 --- a/install-keycloak.sh +++ b/install-keycloak.sh @@ -1369,7 +1369,7 @@ blank_line echononl "Backup Keycloak Installation directory.." 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 echo_failed error "$(cat "$log_file")" @@ -1381,12 +1381,16 @@ else fi echononl "Remove Symlink '${KEYCLOAK_BASE_INSTALL_PATH}/keycloak' .." -rm "${KEYCLOAK_BASE_INSTALL_PATH}/keycloak" > "$log_file" 2>&1 -if [[ $? -ne 0 ]]; then - echo_failed - error "$(cat "$log_file")" +if [[ -h "${KEYCLOAK_BASE_INSTALL_PATH}/keycloak" ]] ; then + rm "${KEYCLOAK_BASE_INSTALL_PATH}/keycloak" > "$log_file" 2>&1 + if [[ $? -ne 0 ]]; then + echo_failed + error "$(cat "$log_file")" + else + echo_ok + fi else - echo_ok + echo_skipped fi diff --git a/uprgade-keycloak.sh b/uprgade-keycloak.sh index 2804185..0e03c65 100755 --- a/uprgade-keycloak.sh +++ b/uprgade-keycloak.sh @@ -579,7 +579,7 @@ blank_line echononl "Backup Keycloak Installation directory.." 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 echo_failed error "$(cat "$log_file")" @@ -615,7 +615,7 @@ fi blank_line 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 echo_failed error "$(cat "$log_file")" @@ -624,7 +624,7 @@ else fi 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 echo_failed error "$(cat "$log_file")" @@ -633,7 +633,7 @@ else fi 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 echo_failed error "$(cat "$log_file")" @@ -750,14 +750,29 @@ if [[ $? -ne 0 ]]; then echo_failed error "$(cat "$log_file")" - 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" + if $terminal ; then + 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 + 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 echo_ok fi @@ -769,6 +784,26 @@ systemctl start keycloak.service > "$log_file" 2>&1 if [[ $? -ne 0 ]]; then echo_failed 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 echo_ok fi