#!/bin/sh

set -e

# TODO(jelmer): Should this perhaps run as its own user rather than as prometheus?

case "$1" in
  configure)
    # Add prometheus user
    if ! getent passwd prometheus > /dev/null; then
        adduser --quiet --system --home /var/lib/prometheus --no-create-home \
            --group --gecos "Prometheus daemon" prometheus || true
    fi
    chown prometheus:prometheus /var/lib/prometheus || true

  ;;

  abort-upgrade|abort-remove|abort-deconfigure)
    :
  ;;

  *)
    echo "postinst called with unknown argument \`$1'" >&2
    exit 1
  ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
