1
|
#!/bin/sh
|
2
|
#
|
3
|
# Postinst script for wcsinstd
|
4
|
#
|
5
|
|
6
|
set -e
|
7
|
|
8
|
NAME=wcsinstd
|
9
|
WCSINSTD_USER=wcs-au-quotidien
|
10
|
WCSINSTD_GROUP=wcs-au-quotidien
|
11
|
WCSINSTD_HOME=/var/lib/$NAME
|
12
|
WCSINSTD_INIT=/etc/init.d/$NAME
|
13
|
|
14
|
case "$1" in
|
15
|
configure)
|
16
|
if ! getent group $WCSINSTD_GROUP > /dev/null 2>&1; then
|
17
|
echo -n "Adding group $WCSINSTD_GROUP.."
|
18
|
addgroup --quiet --system $WCSINSTD_GROUP
|
19
|
echo "..done"
|
20
|
fi
|
21
|
if ! getent passwd $WCSINSTD_USER > /dev/null 2>&1; then
|
22
|
echo -n "Adding user $WCSINSTD_USER.."
|
23
|
adduser --quiet --system --gecos "wcsinst daemon" \
|
24
|
--ingroup $WCSINSTD_GROUP \
|
25
|
--no-create-home --home $WCSINSTD_HOME \
|
26
|
$WCSINSTD_USER
|
27
|
echo "..done"
|
28
|
fi
|
29
|
|
30
|
chown -R $WCSINSTD_USER:$WCSINSTD_GROUP $WCSINSTD_HOME /var/run/$NAME /var/log/$NAME
|
31
|
chown -R $WCSINSTD_USER:$WCSINSTD_GROUP $WCSINSTD_HOME/static $WCSINSTD_HOME/extra-static
|
32
|
chown -R $WCSINSTD_USER:$WCSINSTD_GROUP $WCSINSTD_HOME/media $WCSINSTD_HOME/templates
|
33
|
# echo -n "Initializing sqlite database.."
|
34
|
# $WCSINSTD_INIT manage syncdb --migrate
|
35
|
if [ ! -f /etc/$NAME/secret ]; then
|
36
|
echo -n "Generating secret.."
|
37
|
dd if=/dev/random ibs=1 count=32 2>/dev/null >/etc/$NAME/secret
|
38
|
echo "..done"
|
39
|
fi
|
40
|
echo -n "Generating static files.."
|
41
|
$WCSINSTD_INIT manage collectstatic --noinput --link
|
42
|
echo "..done"
|
43
|
|
44
|
;;
|
45
|
|
46
|
reconfigure)
|
47
|
echo -n "Generating static files.."
|
48
|
$WCSINSTD_INIT manage collectstatic --noinput --link
|
49
|
echo "..done"
|
50
|
|
51
|
;;
|
52
|
|
53
|
abort-upgrade|abort-remove|abort-deconfigure)
|
54
|
;;
|
55
|
|
56
|
*)
|
57
|
echo "postinst called with unknown argument \`$1'" >&2
|
58
|
exit 1
|
59
|
;;
|
60
|
esac
|
61
|
|
62
|
case "$1" in
|
63
|
configure)
|
64
|
if [ -z "$2" ]; then
|
65
|
# echo -n "Initializing sqlite database.."
|
66
|
# $WCSINSTD_INIT manage syncdb --migrate
|
67
|
true
|
68
|
fi
|
69
|
;;
|
70
|
esac
|
71
|
|
72
|
# dh_installdeb will replace this with shell code automatically
|
73
|
# generated by other debhelper scripts.
|
74
|
|
75
|
#DEBHELPER#
|
76
|
|
77
|
exit 0
|