forked from opencpu/opencpu-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opencpu-server.postinst
74 lines (60 loc) · 1.94 KB
/
opencpu-server.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
#!/bin/sh
set -e
case "$1" in
configure)
:
# Adding OpenCPU User.
echo "Adding user opencpu..."
useradd opencpu --system -U -d/tmp -c"OpenCPU Server" || true
echo "creating log files."
touch /var/log/opencpu/access.log
touch /var/log/opencpu/error.log
echo "taking ownership of system directories."
chown -Rf opencpu /var/log/opencpu
chgrp -Rf opencpu /var/log/opencpu
chown -Rf opencpu /etc/opencpu
chgrp -Rf opencpu /etc/opencpu
chown -Rf opencpu /usr/lib/opencpu/
chgrp -Rf opencpu /usr/lib/opencpu/
echo "making scripts executable."
chmod +x /usr/lib/opencpu/scripts/*.sh
#remove cron files from older versions
rm -f /etc/cron.d/opencpu-* || true
#In Apache 2.4 we need to make sure mpm_prefork is enabled
if command -v a2query >/dev/null 2>&1; then
if a2query -q -m mpm_event; then
a2dismod mpm_event || true
fi
if a2query -q -m mpm_worker; then
a2dismod mpm_worker || true
fi
if a2query -q -m mpm_itk; then
a2dismod mpm_itk || true
fi
a2enmod mpm_prefork || true
fi
#setup rstudio proxy
a2enmod proxy 2>&1 >/dev/null | grep -i 'error' || true
a2enmod proxy_http 2>&1 >/dev/null | grep -i 'error' || true
a2ensite rstudio 2>&1 >/dev/null | grep -i 'error' || true
#try to enable ssl site
a2enmod ssl 2>&1 >/dev/null | grep -i 'error' || true
a2ensite default-ssl 2>&1 >/dev/null | grep -i 'error' || true
#reload apparmor
echo "reloading apparmor"
service apparmor reload 2>&1 >/dev/null | grep -i 'error' || true
echo "installing opencpu init script."
chmod 755 /usr/lib/opencpu/init.d/opencpu
update-rc.d opencpu defaults
service opencpu start
#done
echo "Installation done."
;;
abort-upgrade | abort-remove | abort-deconfigure)
:
;;
*) echo "$0: didn't understand being called with \`$1'" 1>&2
exit 1;;
esac
#DEBHELPER#
exit 0