#!/bin/bash

# arg 1:  the new package version
post_install() {
	if [[ ! -e /etc/synapse/homeserver.yaml ]]; then
		cat <<-EOF
		==> A synapse configuration file needs to be generated before you can
		    start synapse, and you should make sure that it's readable by the
		    synapse user.

		    cd /var/lib/synapse
		    sudo -u synapse python2 -m synapse.app.homeserver \\
		      --server-name my.domain.name \\
		      --config-path /etc/synapse/homeserver.yaml \\
		      --generate-config \\
		      --report-stats=yes

		    N.B.: The default synapse config enables the webclient feature.
		    Unless you have python2-matrix-angular-sdk installed this will make
		    synapse fail to start.  Either disable it, or install
		    python2-matrix-angular-sdk.
		EOF
		install -dm700 -o 198 -g 198 /var/lib/synapse
	fi

}

# arg 1:  the new package version
# arg 2:  the old package version
post_upgrade() {
	cat <<-EOF
	==> N.B.: The default synapse config enables the webclient feature.
	    Unless you have python2-matrix-angular-sdk installed this will make
	    synapse fail to start.  Either disable it, or install
	    python2-matrix-angular-sdk.
	EOF
}
