post_install() { # Install the user and group if they don't exist getent passwd syncthing >/dev/null || { useradd -r -U -s /bin/nologin -d /var/discosrv syncthing printf '%s\n' 'The syncthing user and group have been created' } getent passwd syncthing | grep -q '/var/discosrv' \ || printf '%s\n' 'WARNING: The syncthing user home is not /var/discosrv' printf '\n%s\n' 'Syncthing expects an SSL certificate and key located at' printf '%s\n\n' '/var/discosrv/cert.pem and /var/discosrv/key.pem' printf '%s\n' 'Move to /var/discosrv and run the following commands as root:' printf '%s\n' '$ openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 3650 -nodes' printf '%s\n' '$ chown syncthing:syncthing cert.pem key.pem' } post_upgrade() { post_install }