forked from xenocrat/chyrp-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
31 lines (25 loc) · 804 Bytes
/
entrypoint.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
#!/bin/bash
sync_config() {
inotifywait -qme close_write,moved_to,create /var/www/html/includes/ --format '%f' \
| while read -r filename; do
if [ "$filename" = "config.json.php" ]; then
cp /var/www/html/includes/config.json.php /data/config.json.php
fi
done
}
upgrade() {
until curl -Ifso /dev/null http://localhost/upgrade.php; do
sleep 0.1
done
curl -fso /dev/null -X POST -d "upgrade=yes" http://localhost/upgrade.php
rm /var/www/html/upgrade.php
echo "Upgrade complete."
}
if [ -f /data/config.json.php ]; then
cp /data/config.json.php /var/www/html/includes/config.json.php
rm /var/www/html/install.php
upgrade=true
fi
sync_config &
[ "$upgrade" = true ] && upgrade &
exec apache2-foreground