summarylogtreecommitdiffstats
path: root/syncthing-discosrv.install
blob: 5e8937319fc03370c30f19c53a14c0e0613633c7 (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'

  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
}