summarylogtreecommitdiffstats
path: root/syncthing-discosrv.install
blob: 1a2e20b8957be3cbbd4ba2ac80e6216dd2bc16b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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'

  # Setup the systemd tmpfiles
  systemd-tmpfiles --create syncthing-discosrv.conf

  printf '\n%s\n' 'Syncthing expects an SSL certificate and key located at'
  printf '%s\n' '/var/discosrv/cert.pem and /var/discosrv/key.pem'
}

post_upgrade() {
    post_install
}