blob: 8234bc8c6a5d9b31dcf97d04d4c6c460ab025ca5 (
plain)
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
DATA_DIR="/var/lib/synapse"
ask_report_stats() {
cat <<-EOF
:: Please opt in or out of reporting anonymized homeserver usage statistics, by
setting the report_stats key in your config file
(/etc/synapse/homeserver.yaml) to either True or False.
We would really appreciate it if you could help our project out by reporting
anonymized usage statistics from your homeserver. Only very basic aggregate
data (e.g. number of users) will be reported, but it helps us to track the
growth of the Matrix community, and helps us to make Matrix a success,
as well as to convince other networks that they should peer with us.
Thank you.
:: Note that the homeserver won't start unless you make the choice.
EOF
}
post_upgrade() {
systemctl daemon-reload
if (( $(vercmp "$2" "0.10.1.rc1-3") < 0 )); then
ask_report_stats
fi
}
## arg 1: the new package version
post_install() {
systemd-sysusers /usr/lib/sysusers.d/synapse.conf
systemctl daemon-reload
if [[ ! -e /etc/synapse/homeserver.yaml ]]; then
cat <<-EOF
:: A sample configuration file will be created in /etc/synapse/homeserver.yaml,
using /var/lib/synapse as the data directory and localhost:8448 as server name
and port. Customize it as necessary or regenerate with the following command:
python2.7 -m synapse.app.homeserver --config-path <...> --generate-config
(pass --help to see other options).
EOF
install -dm700 -o synapse -g synapse "$DATA_DIR"
cd "$DATA_DIR"
# we pass --report-stats just to make it generate the config
python2.7 \
-m synapse.app.homeserver \
--config-path /etc/synapse/homeserver.yaml \
--generate-config \
--server-name localhost \
--bind-port 8448 \
--report-stats=no
# let user make the choice
sed -re 's|^(report_stats:.*)$|#&|' \
-i /etc/synapse/homeserver.yaml
echo
ask_report_stats
fi
}
|