-
Notifications
You must be signed in to change notification settings - Fork 4
/
postinst
78 lines (58 loc) · 2.21 KB
/
postinst
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
set -e
# Will start services depending on the action taken
# @see https://wiki.debian.org/MaintainerScripts
case "$1" in
configure)
# Setup appserver by calling server.php with -s install to trigger install mode setup
cd /opt/appserver
./server.php -s install
# Set the permissions for init scripts
chmod 755 /usr/sbin/appserverctl
if [ -z "$2" ]
then
# We did not get a former installed version, so we assume a fresh installation
# Make the link to our system systemd file
ln -sf /lib/systemd/system/appserver.service /etc/systemd/system/appserver.service
ln -sf /lib/systemd/system/appserver-watcher.service /etc/systemd/system/appserver-watcher.service
ln -sf /lib/systemd/system/appserver-php5-fpm.service /etc/systemd/system/appserver-php5-fpm.service
# Reload shared library list
ldconfig
# Reload the systemd daemon
systemctl daemon-reload
# Start the appserver + watcher + fpm
systemctl start appserver.service
systemctl start appserver-watcher.service
systemctl start appserver-php5-fpm.service
elif [ -n "$2" ]
then
# Reload shared library list
ldconfig
# Reload the systemd daemon due to file overrides
systemctl daemon-reload
# Conditionally restart the appserver + watcher + fpm
systemctl status appserver > /dev/null 2>&1;
if [ $? -eq 0 ]
then
systemctl restart appserver.service
fi
systemctl status appserver-watcher > /dev/null 2>&1;
if [ $? -eq 0 ]
then
systemctl restart appserver-watcher.service
fi
systemctl status appserver-php5-fpm > /dev/null 2>&1;
if [ $? -eq 0 ]
then
systemctl restart appserver-php5-fpm.service
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 0
;;
esac
exit 0