aboutsummaryrefslogtreecommitdiff
path: root/dns/powerdns-recursor/pkg-install
blob: 8177e29e7cd1eb585e70068f61adf9b385a96f38 (plain) (blame)
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
#!/bin/sh

if [ "$2" != "PRE-INSTALL" ]; then
    exit 0
fi

PDNSUSER=${PDNSUSER:-pdns_recursor}
PDNSUID=${PDNSUID:-120}
PDNSGROUP=${PDNSGROUP:-pdns}
PDNSGID=${PDNSGID:-120}

if ! pw groupshow "$PDNSGROUP" 2>/dev/null 1>&2; then
	if pw groupadd $PDNSGROUP -g $PDNSGID; then
		echo "=> Added group \"$PDNSGROUP\"."
	else
		echo "=> Adding group \"$PDNSGROUP\" failed..."
		exit 1
	fi
fi

if ! pw usershow "$PDNSUSER" 2>/dev/null 1>&2; then
	if pw useradd $PDNSUSER -u $PDNSUID -g $PDNSGROUP -h - \
		-s "/sbin/nologin" -d "/nonexistent" \
		-c "pdns_recursor pseudo-user"; \
	then
		echo "=> Added user \"$PDNSUSER\"."
	else
		echo "=> Adding user \"$PDNSUSER\" failed..."
		exit 1
	fi
fi
exit 0