forked from dsavell/docker-grav
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-core
executable file
·61 lines (52 loc) · 1.56 KB
/
init-core
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Install GRAV
mkdir -p \
/var/www/grav
if [[ -f /grav/grav.zip ]]; then
unzip /grav/grav.zip -d /grav
files=('.htaccess' 'CHANGELOG.md' 'CODE_OF_CONDUCT.md' 'CONTRIBUTING.md' 'LICENSE.txt' 'README.md' 'composer.json' 'composer.lock' 'index.php' 'robots.txt')
for i in "${files[@]}"
do
mv /grav/grav/$i /var/www/grav/
done
dirs=('assets' 'bin' 'cache' 'images' 'system' 'tmp' 'vendor' 'webserver-configs')
for i in "${dirs[@]}"
do
mv /grav/grav/$i /var/www/grav/
done
fi
# Setup GRAV
if [[ ! -e /var/www/grav/backup/.gitkeep ]]; then
echo "Fresh Install moving backup"
cp -r /grav/grav/backup /var/www/grav
fi
if [[ ! -e /var/www/grav/logs/.gitkeep ]]; then
echo "Fresh Install moving logs"
cp -r /grav/grav/logs /var/www/grav
fi
if [[ ! -e /var/www/grav/user/config/site.yaml ]]; then
echo "Fresh Install moving user configs"
cp -r /grav/grav/user /var/www/grav
fi
# Clean
rm -rf /grav
rm -rf /var/www/html
DUID=${DUID:-911}
DGID=${DGID:-911}
groupmod -o -g "$DGID" xyz
usermod -o -u "$DUID" xyz
sed -i -e 's/www-data/xyz/g' /etc/php/7.3/fpm/pool.d/www.conf
# Set Permissions
chown -R xyz:xyz /var/www
find /var/www/grav -type f | xargs -d '\n' chmod 664
find /var/www/grav/bin -type f | xargs -d '\n' chmod 775
find /var/www/grav -type d | xargs -d '\n' chmod 775
find /var/www/grav -type d | xargs -d '\n' chmod +s
umask 0002
service php7.3-fpm start
service nginx start
## start cron
service cron start
## trap SIGINT and SIGTERM signals and gracefully exit
trap "service cron stop; kill \$!; exit" SIGINT SIGTERM
tail -f /dev/null