post_install() {
  getent group chrony 2> /dev/null || groupadd -g 183 chrony > /dev/null
  getent passwd chrony 2> /dev/null \
    || useradd -u 183 -g chrony -d /var/lib/chrony \
    -c 'Network Time Protocol' -s /bin/false chrony > /dev/null
}

post_upgrade() {
  if [ $(vercmp $2 1.29.1-2) -le 0 ]; then
    getent group chrony 2> /dev/null || groupadd -r -g 183 chrony > /dev/null
    getent passwd chrony 2> /dev/null \
      || useradd -r -u 183 -g chrony -d /var/lib/chrony \
      -c 'Network Time Protocol' -s /bin/false chrony > /dev/null
    chown -R 183:183 /var/lib/chrony
  fi
}

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