-
Notifications
You must be signed in to change notification settings - Fork 35
/
post_update.sh
34 lines (28 loc) · 1003 Bytes
/
post_update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
set -eu
# Run migrations in /root/migrations.
if [ ! -e /root/migrations/current_migration.txt ]
then
echo "0" > /root/migrations/current_migration.txt
fi
current_migration=$(cat /root/migrations/current_migration.txt)
while [ -f "/root/migrations/$((current_migration+1)).sh" ]
do
echo "* [migrate] Migrating from $current_migration to $((current_migration+1))."
{
"/root/migrations/$((current_migration+1)).sh" &&
current_migration=$((current_migration+1)) &&
echo "* [migrate] Migration $current_migration done." &&
echo "$current_migration" > /root/migrations/current_migration.txt
} || {
echo "ERROR - Fail to run migrations."
# Do not exit so the post_update script can continue.
break
}
done
# Generate some configuration from templates.
sync_configuration
# Removing rwx permission on the nextcloud folder to others users
chmod -R o-rwx /usr/local/www/nextcloud
# Give full ownership of the nextcloud directory to www
chown -R www:www /usr/local/www/nextcloud