Debian Codegraph @

debian/postinst

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