| 1 | #!/bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | # summary of how this script can be called: |
| 6 | # * <postinst> `configure' <most-recently-configured-version> |
| 7 | # * <old-postinst> `abort-upgrade' <new version> |
| 8 | # * <conflictor's-postinst> `abort-remove' `in-favour' <package> |
| 9 | # <new-version> |
| 10 | # * <deconfigured's-postinst> `abort-deconfigure' `in-favour' |
| 11 | # <failed-install-package> <version> `removing' |
| 12 | # <conflicting-package> <version> |
| 13 | # for details, see http://www.debian.org/doc/debian-policy/ or |
| 14 | # the debian-policy package |
| 15 | # |
| 16 | # quoting from the policy: |
| 17 | # Any necessary prompting should almost always be confined to the |
| 18 | # post-installation script, and should be protected with a conditional |
| 19 | # so that unnecessary prompting doesn't happen if a package's |
| 20 | # installation fails and the `postinst' is called with `abort-upgrade', |
| 21 | # `abort-remove' or `abort-deconfigure'. |
| 22 | |
| 23 | case "$1" in |
| 24 | configure) |
| 25 | # Add prometheus user |
| 26 | if ! getent passwd prometheus > /dev/null; then |
| 27 | adduser --quiet --system --home /var/lib/prometheus --no-create-home \ |
| 28 | --group --gecos "Prometheus daemon" prometheus || true |
| 29 | fi |
| 30 | |
| 31 | chown prometheus:prometheus /var/lib/prometheus || true |
| 32 | chown prometheus:prometheus /var/log/prometheus || true |
| 33 | ;; |
| 34 | |
| 35 | abort-upgrade|abort-remove|abort-deconfigure) |
| 36 | : |
| 37 | ;; |
| 38 | |
| 39 | *) |
| 40 | echo "postinst called with unknown argument \`$1'" >&2 |
| 41 | exit 1 |
| 42 | ;; |
| 43 | esac |
| 44 | |
| 45 | # dh_installdeb will replace this with shell code automatically |
| 46 | # generated by other debhelper scripts. |
| 47 | |
| 48 | #DEBHELPER# |
| 49 | |
| 50 | exit 0 |