diff --git a/install_nextcloud.sh b/install_nextcloud.sh index 769fd78..324f109 100755 --- a/install_nextcloud.sh +++ b/install_nextcloud.sh @@ -1002,7 +1002,7 @@ else fi -DATA_DIR=${WEB_BASE_DIR}/data-${VERSION} +DATA_DIR=${WEB_BASE_DIR}/data INSTALL_DIR=${WEB_BASE_DIR}/nextcloud-${VERSION} @@ -2789,6 +2789,37 @@ if [[ -d "$DATA_DIR" ]] ; then fi fi +# - Delete symlink for data directory +# - +echononl "Delete symlink '${DATA_DIR}' if exists.." +if [[ -h "${DATA_DIR}" ]]; then + + echo "" >> $log_file + echo "# - Delete symlink '${DATA_DIR}'" >> $log_file + echo "# -" >> $log_file + + echo "rm \"${DATA_DIR}\"" >> $log_file + rm "${DATA_DIR}" >> $log_file 2>&1 + + if [[ $? -eq 0 ]]; then + echo_ok + else + echo_failed + error "For more informations see log output at '$log_file'." + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interrupted ny user." + fi +else + echo_skipped +fi + if $checks_all_is_fine ; then info "All is fine.." fi @@ -2810,11 +2841,11 @@ echo "# - Download/Unpack sources" >> $log_file echo "# -----" >> $log_file -echononl "Create source directory '${DATA_DIR}'.." +echononl "Create source directory '${SRC_BASE_DIR}'.." if [[ ! -d "${SRC_BASE_DIR}" ]]; then echo "" >> $log_file - echo "# - Create source directory '${DATA_DIR}'" >> $log_file + echo "# - Create source directory '${SRC_BASE_DIR}'" >> $log_file echo "# -" >> $log_file echo "mkdir \"${SRC_BASE_DIR}\"" >> $log_file @@ -3186,124 +3217,6 @@ else fi -# - Set Permissions on new data directory -# - -echo "" >> $log_file -echo "# - Change permissions on '${DATA_DIR}'" >> $log_file -echo "# -" >> $log_file -echononl "Change permissions on '${DATA_DIR}'.." - -echo "chown -R \"${HTTP_USER}\":\"${HTTP_GROUP}\" \"${DATA_DIR}\"" >> $log_file -chown -R "${HTTP_USER}":"${HTTP_GROUP}" "${DATA_DIR}" >> $log_file 2>&1 - -if [[ $? -eq 0 ]]; then - echo_ok -else - echo_failed - error "For more informations see log output at '$log_file'." - - echononl "continue anyway [yes/no]: " - read OK - OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" - while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do - echononl "Wrong entry! - repeat [yes/no]: " - read OK - done - [[ $OK = "yes" ]] || fatal "Interrupted ny user." -fi - - - -# - Delete symlink for old data directory -# - -echononl "Delete symlink '${WEB_BASE_DIR}/data' if exists.." -if [[ -h "${WEB_BASE_DIR}/data" ]]; then - - echo "" >> $log_file - echo "# - Delete symlink '${WEB_BASE_DIR}/data'" >> $log_file - echo "# -" >> $log_file - - echo "rm \"${WEB_BASE_DIR}/data\"" >> $log_file - rm "${WEB_BASE_DIR}/data" >> $log_file 2>&1 - - if [[ $? -eq 0 ]]; then - echo_ok - else - echo_failed - error "For more informations see log output at '$log_file'." - - echononl "continue anyway [yes/no]: " - read OK - OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" - while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do - echononl "Wrong entry! - repeat [yes/no]: " - read OK - done - [[ $OK = "yes" ]] || fatal "Interrupted ny user." - fi -else - echo_skipped -fi - - -if [[ -f "${WEB_BASE_DIR}/data" ]] || [[ -d "${WEB_BASE_DIR}/data" ]] ; then - warn "File or Directory '${WEB_BASE_DIR}/data' exists." - - echo "" >> $log_file - echo "# - Backup directory '${WEB_BASE_DIR}/data'" >> $log_file - echo "# -" >> $log_file - echononl "Backup directory '${WEB_BASE_DIR}/data'.." - - echo "mv \"${WEB_BASE_DIR}/data\" \"${WEB_BASE_DIR}/data.$backup_date\"" >> $log_file - mv "${WEB_BASE_DIR}/data" "${WEB_BASE_DIR}/data.$backup_date" >> $log_file 2>&1 - - if [[ $? -eq 0 ]]; then - echo_ok - else - echo_failed - error "For more informations see log output at '$log_file'." - - echononl "continue anyway [yes/no]: " - read OK - OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" - while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do - echononl "Wrong entry! - repeat [yes/no]: " - read OK - done - [[ $OK = "yes" ]] || fatal "Interrupted ny user." - fi -else - echo_skipped -fi - - -# - Set symlink for new data directory -# - -echo "" >> $log_file -echo "# - Set symlink for new data dir 'data-${VERSION}'" >> $log_file -echo "# -" >> $log_file -echononl "Set symlink for new data dir 'data-${VERSION}'.." - -echo "\"ln -s data-${VERSION}\" \"${WEB_BASE_DIR}/data\"" >> $log_file -ln -s "data-${VERSION}" "${WEB_BASE_DIR}/data" >> $log_file 2>&1 - -if [[ $? -eq 0 ]]; then - echo_ok -else - echo_failed - error "For more informations see log output at '$log_file'." - - echononl "continue anyway [yes/no]: " - read OK - OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" - while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do - echononl "Wrong entry! - repeat [yes/no]: " - read OK - done - [[ $OK = "yes" ]] || fatal "Interrupted ny user." -fi - - # - Delete symlink for old installation directory # - echononl "Delete symlink '${WEB_BASE_DIR}/nextcloud' if exists.."