uprgade-keycloak.sh: Changes when importing existing configuration files.
This commit is contained in:
@@ -643,41 +643,67 @@ 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
|
||||
echononl "Copy configuration files from the previous installation to the new installation."
|
||||
|
||||
# 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
|
||||
_failed=false
|
||||
: > "$log_file"
|
||||
|
||||
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")"
|
||||
SRC_DIR="${CUR_INSTALL_DIR}.${backup_date}/conf"
|
||||
DST_DIR="${KEYCLOAK_INSTALL_DIR}/conf"
|
||||
|
||||
if $terminal ; then
|
||||
for ext in conf json; do
|
||||
|
||||
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"
|
||||
# Prüfen ob überhaupt Dateien mit dieser Endung existieren
|
||||
shopt -s nullglob
|
||||
files=("${SRC_DIR}"/*.${ext})
|
||||
shopt -u nullglob
|
||||
|
||||
if [[ ${#files[@]} -eq 0 ]]; then
|
||||
|
||||
# no files *.${ext} found in ${SRC_DIR}
|
||||
continue
|
||||
fi
|
||||
|
||||
for src_file in "${files[@]}"; do
|
||||
filename=$(basename "${src_file}")
|
||||
dst_file="${DST_DIR}/${filename}"
|
||||
|
||||
# Existierende Zieldatei sichern
|
||||
if [[ -f "${dst_file}" ]]; then
|
||||
|
||||
orig_file="${dst_file}.ORIG"
|
||||
|
||||
# Backup '${dst_file}'
|
||||
# '${dst_file}' -> '${orig_file}'
|
||||
cp -p "${dst_file}" "${orig_file}" || {
|
||||
|
||||
echo "Unable to save '$(basename "${dst_file}")'. The file was not copied to the installation directory." >> "$log_file"
|
||||
_failed=true
|
||||
|
||||
# '${dst_file}' nicht sichern. Überspringe.
|
||||
continue
|
||||
}
|
||||
fi
|
||||
|
||||
# Datei ins Zielverzeichnis kopieren
|
||||
# '${src_file}' -> '${dst_file}'"
|
||||
cp -p "${src_file}" "${dst_file}" || {
|
||||
echo " Copying existing '$(basename "${src_file}")' into to installation directory failed!" >> "$log_file"
|
||||
_failed=true
|
||||
}
|
||||
done
|
||||
done
|
||||
|
||||
if ${_failed} ; then
|
||||
echo_failed
|
||||
error "$(cat "$log_file")"
|
||||
else
|
||||
echo_ok
|
||||
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
|
||||
if [[ $? -ne 0 ]]; then
|
||||
|
||||
Reference in New Issue
Block a user