summarylogtreecommitdiffstats
path: root/synapse.install
blob: 7534c0c6e4f615a9666b3fbd7ce07b81ad2324d8 (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
#!/bin/bash

DATA_DIR="/var/lib/synapse"

post_upgrade() {
	systemctl daemon-reload

	if (( $(vercmp "$2" "0.10.1.rc1-3") < 0 )); then
		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
	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"
		python2.7 \
			-m synapse.app.homeserver \
			--config-path /etc/synapse/homeserver.yaml \
			--generate-config \
			--server-name localhost \
			--bind-port 8448
	fi
}