summaryrefslogtreecommitdiff
path: root/pkg/server/soledad-server.postinst
blob: 6a6fcf70a9e88f08be2f0f893190d875df28779a (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
#!/bin/sh

set -e

export PATH=/bin:/usr/bin:/sbin:/usr/sbin

# create soledad group
getent group soledad > /dev/null
RET=$?

if [ ! $RET -eq 0 ]; then
    addgroup --system soledad
fi

# create soledad user
id soledad > /dev/null 2>&1
RET=$?

if [ ! $RET -eq 0 ]; then
  adduser --system soledad --no-create-home --home /var/lib/soledad/ --ingroup soledad
fi

# allow soledad user to read ssl certificates
usermod -aG ssl-cert soledad

# create soledad-admin user
id soledad-admin > /dev/null 2>&1
RET=$?

if [ ! $RET -eq 0 ]; then
  adduser --system soledad-admin --no-create-home --home /var/lib/soledad/ --ingroup soledad
fi

# update systemd and start service
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start soledad-server.service >/dev/null || true