hs.scripts/rollback/nextcloud/update.sh
2024-04-25 13:49:12 +02:00

40 lines
1.0 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -e
# +x does not apply
# use correct order eg: sudo -u www-data php=php8.2 ...
if [ -z ${php} ]; then
php="php8.2"
fi
read -p "DANGER Updating will also rollback this Nextcloud. Proceed? (Yy)" -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # https://stackoverflow.com/questions/1885525/how-do-i-prompt-a-user-for-confirmation-in-bash-script
fi
echo "calling for rollback.sh"
. $HOME/scripts/rollback.sh
echo "proceeding with the update"
$php occ maintenance:mode --on
$php updater/updater.phar -v --no-backup --no-interaction
$php occ db:add-missing-primary-keys --no-interaction
$php occ db:add-missing-columns --no-interaction
$php occ db:add-missing-indices --no-interaction
$php occ db:convert-filecache-bigint --no-interaction
$php occ app:update --all -n --no-ansi
echo "calling setstate.sh to make the update permanent"
. $HOME/scripts/setstate.sh
# since it appears to be unreliable at times
$php occ maintenance:mode --off
echo
echo "all scripts done."