File: munin-async.postinst

package info (click to toggle)
munin 2.999.14-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 10,036 kB
  • sloc: perl: 31,052; sh: 12,473; java: 1,924; python: 852; makefile: 336; ruby: 232; awk: 169; xml: 45; sql: 11
file content (45 lines) | stat: -rwxr-xr-x 932 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /bin/sh

set -e

SPOOLDIR=/var/spool/munin/async
SHELL=/usr/bin/munin-async

ensure_usergroup() {
    if ! getent passwd munin-async >/dev/null; then
        adduser --system \
                --group \
                --no-create-home \
                --home "$SPOOLDIR" \
                --shell "$SHELL" \
                munin-async
    fi

    if ! getent passwd munin-async | cut -d : -f 6 | grep -qx "$SPOOLDIR"; then
	usermod \
            --home "$SPOOLDIR" \
            munin-async
    fi

    if ! getent passwd munin-async | cut -d : -f 7 | grep -qx "$SHELL"; then
        usermod \
            --shell "$SHELL" \
            munin-async
    fi
}

case "$1" in
    configure)
	ensure_usergroup
        install -o munin-async -g munin-async -m 0755 -d "$SPOOLDIR"
	;;
    abort-upgrade|abort-deconfigure|abort-remove)
	:
	;;
    *)
	echo "Called with unknown argument $1, bailing out."
	exit 1
	;;
esac

#DEBHELPER#