diff --git a/add_missing_primary-keys.sh b/add_missing_primary-keys.sh index 33e7cde..f7f56c5 100755 --- a/add_missing_primary-keys.sh +++ b/add_missing_primary-keys.sh @@ -520,7 +520,7 @@ echo -e "\033[37m\033[1mMain part of the script\033[m" echo "" -# - Create missing indices +# - Add missing primary keys .. # - echononl " Add missing primary keys .." su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ db:add-missing-primary-keys" -s /bin/bash $HTTP_USER > $log_file 2>&1 diff --git a/restore_nextcloud.sh b/restore_nextcloud.sh index b13342b..c3e7eae 100755 --- a/restore_nextcloud.sh +++ b/restore_nextcloud.sh @@ -100,7 +100,7 @@ echo_skipped() { } echo_wait(){ if $terminal ; then - echo -en "\033[75G[ \033[5m\033[1m...\033[m ]" + echo -en "\033[75G[ \033[5m\033[1m..\033[m ]" fi } fatal (){ @@ -727,7 +727,7 @@ fi # - Restore Database # - -echononl " Restore Database - \033[5m\033[1mmay take a long time\033[m" +echononl " Restore Database \033[5m\033[1mmay take a long time\033[m" echo_wait if [[ "$DATABASE_TYPE" = 'mysql' ]]; then mysql $MYSQL_CREDENTIALS $DATABASE_NAME < \ @@ -784,8 +784,90 @@ fi echo "" echo "" echo -e "\033[37m\033[1mDoing some post-script tasks..\033[m" - echo "" + +# - Add missing columns +# - +echononl " Add missing columns .." +su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ db:add-missing-columns" -s /bin/bash $HTTP_USER > $log_file 2>&1 +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "$(cat $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 by user." + +fi + +# - Create missing indices +# - +echononl " Add missing indices .." +su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ db:add-missing-indices" -s /bin/bash $HTTP_USER > $log_file 2>&1 +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "$(cat $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 by user." +fi + +# - Add missing primary keys .. +# - +echononl " Add missing primary keys .." +su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ db:add-missing-primary-keys" -s /bin/bash $HTTP_USER > $log_file 2>&1 +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "$(cat $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 by user." +fi + +echononl " Run cronjob manually.." +su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/cron.php" -s /bin/bash $HTTP_USER > $log_file 2>&1 +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "$(cat $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 by user." + +fi + +blank_line + echononl " Restart PHP engine.." if [[ "$PHP_ENGINE" = "FPM" ]]; then if $SYSTEMD_EXISTS ; then diff --git a/update_nextcloud.sh b/update_nextcloud.sh index 0e6fd0a..db34c14 100755 --- a/update_nextcloud.sh +++ b/update_nextcloud.sh @@ -402,7 +402,7 @@ INSTALL_DIR="${WEB_BASE_DIR}/nextcloud-${VERSION}" CURRENT_INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)" #PRIOR_VERSION="$(basename $CURRENT_INSTALL_DIR | cut -d"-" -f2)" -PRIOR_VERSION="$(sudo -u $HTTP_USER /usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ --version | cut -d' ' -f2)" +PRIOR_VERSION="$(sudo -u $HTTP_USER ${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ --version | cut -d' ' -f2)" #DATA_DIR=${WEB_BASE_DIR}/data-${VERSION} #CURRENT_DATA_DIR="$(realpath ${WEB_BASE_DIR}/data-$PRIOR_VERSION)" @@ -662,7 +662,7 @@ if $NGINX_IS_ENABLED ; then fi fi -echo "" +blank_line # - Backup Database # - @@ -701,11 +701,18 @@ elif [[ "$DATABASE_TYPE" = 'postgres' ]]; then echo_ok else echo_failed - fatal "$(cat $log_file)" - fi -fi + error "$(cat $log_file)" -echo + 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 by user." + fi +fi # - Backup old installation directory @@ -717,8 +724,19 @@ if [[ $? -eq 0 ]]; then else echo_failed error "$(cat $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 by user." fi +blank_line + # - Remove symlink from old installation directory # - @@ -728,7 +746,16 @@ if [[ $? -eq 0 ]]; then echo_ok else echo_failed - fatal "$(cat $log_file)" + error "$(cat $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 by user." fi @@ -760,7 +787,16 @@ if [[ $? -eq 0 ]]; then echo_ok else echo_failed - fatal "$(cat $log_file)" + error "$(cat $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 by user." fi # - Kopiere Verzeichnis "config" in das neue Installationsverzeichnis @@ -822,7 +858,16 @@ if [[ $? -eq 0 ]]; then echo_ok else echo_failed - fatal "$(cat $log_file)" + error "$(cat $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 by user." fi @@ -834,7 +879,16 @@ if [[ $? -eq 0 ]]; then echo_ok else echo_failed - fatal "$(cat $log_file)" + error "$(cat $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 by user." fi # - Set Permissions on new data directory @@ -845,7 +899,16 @@ if [[ $? -eq 0 ]]; then echo_ok else echo_failed - fatal "$(cat $log_file)" + error "$(cat $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 by user." fi @@ -858,20 +921,52 @@ if [[ $? -eq 0 ]]; then else echo_failed error "$(cat $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 by user." fi +blank_line + # - Update Nextcloud # - echo "" echo " Update Nextcloud" -su -c"/usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ upgrade" -s /bin/bash $HTTP_USER +su -c"${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ upgrade" -s /bin/bash $HTTP_USER if [[ $? -eq 0 ]]; then info "Updating nextcloud core was successfully.." else fatal "$(cat $log_file)" fi +# Set maintenace mode to 'off'.. !! +# +blank_line +echononl " Set maintenace mode to 'off'.." +su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ maintenance:mode --off" -s /bin/bash $HTTP_USER > $log_file 2>&1 +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "$(cat $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 by user." +fi +blank_line ## ----- @@ -1258,8 +1353,91 @@ fi echo "" echo "" echo -e "\033[37m\033[1mDoing some post-update tasks..\033[m" - echo "" + +# - Add missing columns +# - +echononl " Add missing columns .." +su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ db:add-missing-columns" -s /bin/bash $HTTP_USER > $log_file 2>&1 +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "$(cat $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 by user." + +fi + +# - Create missing indices +# - +echononl " Add missing indices .." +su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ db:add-missing-indices" -s /bin/bash $HTTP_USER > $log_file 2>&1 +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "$(cat $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 by user." +fi + +# - Add missing primary keys .. +# - +echononl " Add missing primary keys .." +su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ db:add-missing-primary-keys" -s /bin/bash $HTTP_USER > $log_file 2>&1 +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "$(cat $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 by user." +fi + +echononl " Run cronjob manually.." +su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/cron.php" -s /bin/bash $HTTP_USER > $log_file 2>&1 +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "$(cat $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 by user." + +fi + +blank_line + + echononl " Restart PHP engine.." if [[ "$PHP_ENGINE" = "FPM" ]]; then if $SYSTEMD_EXISTS ; then