post_install() {
  getent group pdnsd &>/dev/null || groupadd -r -g 184 pdnsd >/dev/null
  getent passwd pdnsd &>/dev/null || useradd -r -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
}
