post_install() {
  if ! getent group mldonkey >/dev/null; then
    groupadd --system mldonkey
  fi
  if ! getent passwd mldonkey >/dev/null; then
    useradd --system -c 'Mldonkey daemon user' -g mldonkey -d /var/lib/mldonkey -s /bin/false mldonkey
  fi

  mkdir -p /var/lib/mldonkey
  chown mldonkey:mldonkey /var/lib/mldonkey

  if type -P systemd-tmpfiles &> /dev/null; then
    systemd-tmpfiles --create mldonkey.conf
  fi
}

post_upgrade() {
  post_install $1
}
