summaryrefslogtreecommitdiffstats
path: root/mail/dcc-dccd/pkg-install
blob: b87b29ee949867d6f5fa45a175a310cc25e17b85 (plain)
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
#!/bin/sh
# $FreeBSD$

PREFIX=${PKG_PREFIX:-%%PREFIX%%}

DCCUSER=%%DCCUSER%%
DCCUID=%%DCCUID%%
DCCGROUP=%%DCCGROUP%%
DCCGID=%%DCCGID%%

if [ "$2" = "PRE-INSTALL" ]; then

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

	if ! pw usershow "$DCCUSER" 2>/dev/null 1>&2; then
		if pw useradd $DCCUSER -u $DCCUID -g $DCCGROUP -h - \
			-s "/sbin/nologin" -d "/nonexistent" \
			-c "Distributed Checksum Clearinghouse"; \
		then
			echo "=> Added user \"$DCCUSER\"."
		else
			echo "=> Adding user \"$DCCUSER\" failed..."
			exit 1
		fi
	fi

fi

exit 0
OpenPOWER on IntegriCloud