-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpostinst
42 lines (32 loc) · 1.31 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
#!/bin/sh -e
# set -x
# export DEBCONF_DEBUG=developer
# Source debconf library.
. /usr/share/debconf/confmodule
# Create screamshotter user (only on a new install)
if [ "$2" = "" ]; then
adduser --system --group --home /opt/screamshotter --quiet screamshotter || true
fi
db_get screamshotter/TIMEOUT; export TIMEOUT="$RET"
db_get screamshotter/MAX_REQUESTS; export MAX_REQUESTS="$RET"
db_get screamshotter/SENTRY_DSN; export SENTRY_DSN="$RET"
db_get screamshotter/SENTRY_ENVIRONMENT; export SENTRY_ENVIRONMENT="$RET"
db_get screamshotter/SENTRY_TRACE_SAMPLE; export SENTRY_TRACE_SAMPLE="$RET"
mkdir -p /opt/screamshotter/static || true
chown -R screamshotter:screamshotter /opt/screamshotter || true
# Generate config files
echo "Generate configuration" >&2
CONF_DIR=/opt/screamshotter/conf
for f in custom.py env gunicorn-screamshotter.conf.py; do
cat > $CONF_DIR/$f << END
# Generated by dpkg installation. DO NOT MODIFY MANUALLY.
# Instead, run "sudo dpkg-reconfigure screamshotter"
# or edit /opt/screamshotter/conf/$f.in
END
envsubst < $CONF_DIR/$f.in >> $CONF_DIR/$f
chown screamshotter.screamshotter $CONF_DIR/$f || true
done
systemctl stop screamshotter || true
usermod -d /opt/screamshotter screamshotter || true # set home directory for old installation without
screamshotter collectstatic --no-input
#DEBHELPER#