From 60faf9dc48ac52cb367e6a39d96aa13969ff6625 Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Sat, 19 Apr 2025 13:24:07 +0200 Subject: InComm --- bin/nextcloud-pharupdate | 97 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100755 bin/nextcloud-pharupdate (limited to 'bin/nextcloud-pharupdate') diff --git a/bin/nextcloud-pharupdate b/bin/nextcloud-pharupdate new file mode 100755 index 0000000..b05404d --- /dev/null +++ b/bin/nextcloud-pharupdate @@ -0,0 +1,97 @@ +#!/usr/bin/env bash + +# This will not be maintained anymore. It's an older script entirely relying +# on updater.phar - and I'm not happy with the latter, so I've integrated this +# into my conf file construct, also for cutover to the new scripts, and then +# be abandoned once production can 100% rely on the new scripts. + +# shellcheck disable=SC1091 +source /etc/lirion/nextcloud.conf || exit 1 + +COREUP=0 +APPSUP=0 +NCSTATUS=0 +UPDCHECK=0 +[ -n "$COLUMNS" ] && MYCOLS="$COLUMNS" +[ -z "$MYCOLS" ] && MYCOLS="$(tput cols 2>/dev/null)" +[ -z "$MYCOLS" ] && MYCOLS="32" +function dashprint { + printf "\\033[;1m" + for (( i=0; i/dev/null 2>&1 || exit 101 +fi +if [ "$NCSTATUS" -eq 1 ];then + sudo -u "${NCUSER}" "$NCPHPBIN" "${NCAPPLDIR}/occ" status + MYRET="$?" + [ "$MYRET" -ne 0 ] && exit "$MYRET" + if [ "$UPDCHECK" -eq 1 ];then + sudo -u "${NCUSER}" "$NCPHPBIN" "${NCAPPLDIR}/occ" update:check + fi + if [ "$COREUP" -eq 1 ] || [ "$APPSUP" -eq 1 ];then + printf "\\nYou selected the status action, not proceeding with updates.\\n" + exit 255 + fi + exit "$MYRET" +fi +if [ "$UPDCHECK" -eq 1 ];then + sudo -u "${NCUSER}" "$NCPHPBIN" "${NCAPPLDIR}/occ" update:check +fi +if [ "$COREUP" -eq 1 ];then + dashprint + printf "\\033[1mupdater/updater.phar\\033[0m\\n" + sudo -u "${NCUSER}" "$NCPHPBIN" "${NCAPPLDIR}/updater/updater.phar" || exit 1 + dashprint +fi +if [ "$APPSUP" -eq 1 ];then + printf "\\033[1mocc app:update --all\\033[0m\\n" + sudo -u "${NCUSER}" "$NCPHPBIN" "${NCAPPLDIR}/occ" app:update --all || exit 2 + # NC 29+: Now there's a message if no updates could be found. Commenting out the following: + # printf "\\033[96mDone.\\033[0m\\n" + dashprint +fi +if [ "$COREUP" -eq 1 ] || [ "$APPSUP" -eq 1 ];then + printf "\\033[1mocc db:add-missing-primary-keys\\033[0m\\n" + sudo -u "${NCUSER}" "$NCPHPBIN" "${NCAPPLDIR}/occ" db:add-missing-primary-keys || exit 3 + dashprint + printf "\\033[1mocc db:add-missing-columns\\033[0m\\n" + sudo -u "${NCUSER}" "$NCPHPBIN" "${NCAPPLDIR}/occ" db:add-missing-columns || exit 4 + printf "\\033[1m-------------------------------\\033[0m\\n" + printf "\\033[1mocc db:add-missing-indices\\033[0m\\n" + sudo -u "${NCUSER}" "$NCPHPBIN" "${NCAPPLDIR}/occ" db:add-missing-indices || exit 5 + printf "\\033[96mDone.\\033[0m\\n" + dashprint + printf "\\033[1mcron.php\\033[0m\\n" + sudo -u "${NCUSER}" "$NCPHPBIN" -f "${NCAPPLDIR}/cron.php" || exit 6 + printf "\\033[96mDone.\\033[0m\\n" + dashprint +fi +if [ "$COREUP" -eq 0 ] && [ "$APPSUP" -eq 0 ] && [ "$NCSTATUS" -eq 0 ] && [ "$UPDCHECK" -eq 0 ];then + hayulp + printf "\\nNo option specified.\\n" >&2 + exit 101 +fi -- cgit v1.2.3