2021-08-18 21:08:44 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
NEXTCLOUD_ROOT="{{ nextcloud_root }}"
|
|
|
|
UPDATER="updater/updater.phar"
|
|
|
|
|
|
|
|
update_db() {
|
2022-03-04 15:11:44 +01:00
|
|
|
for j in $(find "$NEXTCLOUD_ROOT" -maxdepth 1 -mindepth 1 -type d -not -path "$NEXTCLOUD_ROOT/mail2deck"); do
|
|
|
|
USER=$(stat -c %U "$j")
|
|
|
|
echo "Aktualisiere $j..."
|
|
|
|
sudo -u "$USER" php "$j"/occ db:convert-filecache-bigint --no-interaction
|
|
|
|
sudo -u "$USER" php "$j"/occ db:add-missing-indices --no-interaction
|
|
|
|
done
|
2021-08-18 21:08:44 +02:00
|
|
|
}
|
|
|
|
|
2021-08-18 21:22:15 +02:00
|
|
|
update_apps() {
|
2022-03-04 15:11:44 +01:00
|
|
|
for k in $(find "$NEXTCLOUD_ROOT" -maxdepth 1 -mindepth 1 -type d -not -path "$NEXTCLOUD_ROOT/mail2deck"); do
|
|
|
|
USER=$(stat -c %U "$k")
|
|
|
|
echo "Aktualisiere $k..."
|
|
|
|
sudo -u "$USER" php "$k"/occ app:update --all
|
|
|
|
done
|
2021-08-18 21:22:15 +02:00
|
|
|
}
|
|
|
|
|
2021-08-18 21:08:44 +02:00
|
|
|
case "$1" in
|
2022-03-04 15:11:44 +01:00
|
|
|
all)
|
|
|
|
for i in $(find "$NEXTCLOUD_ROOT" -maxdepth 1 -mindepth 1 -type d -not -path "$NEXTCLOUD_ROOT/mail2deck"); do
|
|
|
|
USER=$(stat -c %U "$i")
|
|
|
|
echo "Aktualisiere $i..."
|
|
|
|
sudo -u "$USER" php "$i"/"$UPDATER" --no-interaction
|
|
|
|
done
|
|
|
|
update_apps
|
|
|
|
update_db
|
|
|
|
;;
|
|
|
|
apps)
|
|
|
|
update_apps
|
|
|
|
;;
|
|
|
|
db)
|
|
|
|
update_db
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: nextcloud-updater {all|apps|db}"
|
|
|
|
exit 1
|
2021-08-18 21:08:44 +02:00
|
|
|
esac
|