summaryrefslogtreecommitdiff
path: root/community/pdnsd/pdnsd.install
blob: 4731bc29839f8417399549023688c1538de5ab89 (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
post_install() {
  getent group pdnsd &>/dev/null || groupadd -g 184 pdnsd >/dev/null
  getent passwd pdnsd &>/dev/null || useradd -u 184 -g pdnsd -d /var/cache/pdnsd -c 'Proxy DNS server' -s /bin/nologin pdnsd >/dev/null
  true
}

post_upgrade() {
  if [[ $(vercmp $2 1.2.9.a-6) -le 0 ]]; then
    echo Stopping pdnsd service in order to modify the user/group.
    systemctl stop pdnsd

    # in case the user/group were already created as recommended by the wiki
    userdel pdnsd &>/dev/null
    groupdel pdnsd &>/dev/null

    post_install
    chown -R 184:184 /var/cache/pdnsd

    echo You may now restart the pdnsd service.
  fi
}

post_remove() {
  getent passwd pdnsd &>/dev/null && userdel pdnsd >/dev/null
  getent group pdnsd &>/dev/null && groupdel pdnsd >/dev/null
  true
}