diff --git a/uprgade-keycloak.sh b/uprgade-keycloak.sh index 0e03c65..f8428fe 100755 --- a/uprgade-keycloak.sh +++ b/uprgade-keycloak.sh @@ -614,14 +614,69 @@ fi blank_line +echononl "Copy new keycloak.conf keycloak.conf.ORIG" +if [[ -f "${KEYCLOAK_INSTALL_DIR}/conf/keycloak.conf" ]] ; then + cp -a "${KEYCLOAK_INSTALL_DIR}/conf/keycloak.conf" \ + "${KEYCLOAK_INSTALL_DIR}/conf/keycloak.conf.ORIG" > "$log_file" 2>&1 + + if [[ $? -ne 0 ]]; then + echo_failed + error "$(cat "$log_file")" + + 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 + +else + echo_skipped +fi + echononl "Copy 'conf/ directory from the previous installation to the new installation." -cp -a "${CUR_INSTALL_DIR}.${backup_date}/conf" "${KEYCLOAK_INSTALL_DIR}/" > "$log_file" 2>&1 + +#cp -a "${CUR_INSTALL_DIR}.${backup_date}/conf" "${KEYCLOAK_INSTALL_DIR}/" > "$log_file" 2>&1 + +# shopt -s extglob +# cp -r ${CUR_INSTALL_DIR}.${backup_date}/conf/!('cache-ispn.xml'|'README.md') \ +# ${KEYCLOAK_INSTALL_DIR}/conf/ > "$log_file" 2>&1 +# shopt -u extglob + +find "${CUR_INSTALL_DIR}.${backup_date}/conf" -type f \ + ! -name 'cache-ispn.xml' \ + ! -name 'README.md' \ + ! -name 'keycloak.conf.ORIG' \ + -exec cp --parents {} "${KEYCLOAK_INSTALL_DIR}/conf" \; > "$log_file" 2>&1 + if [[ $? -ne 0 ]]; then echo_failed error "$(cat "$log_file")" + + 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 +fi echononl "Copy 'providers/ directory from the previous installation to the new installation." cp -a "${CUR_INSTALL_DIR}.${backup_date}/providers" "${KEYCLOAK_INSTALL_DIR}/" > "$log_file" 2>&1 @@ -630,7 +685,7 @@ if [[ $? -ne 0 ]]; then error "$(cat "$log_file")" else echo_ok -fi +fi echononl "Copy 'themes/ directory from the previous installation to the new installation." cp -a "${CUR_INSTALL_DIR}.${backup_date}/themes" "${KEYCLOAK_INSTALL_DIR}/" > "$log_file" 2>&1 @@ -639,7 +694,7 @@ if [[ $? -ne 0 ]]; then error "$(cat "$log_file")" else echo_ok -fi +fi echononl "Set ownbership of installation directory '${KEYCLOAK_INSTALL_DIR}'.." @@ -667,7 +722,7 @@ if [[ $? -ne 0 ]]; then error "$(cat "$log_file")" else echo_ok -fi +fi _certs_installed=false