summaryrefslogtreecommitdiff
path: root/audio/firefly/files/pkg-install.in
blob: 4af21224868d932b91aa66dadaffb227257aed0d (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
#
# $FreeBSD: /tmp/pcvs/ports/audio/firefly/files/Attic/pkg-install.in,v 1.2 2010-11-26 23:07:50 beech Exp $
#

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

SC_GROUP=%%GROUP%%
SC_USER=%%USER%%
SC_SHELL=/sbin/nologin
SC_HOME=/nonexistent
PW=`which pw`

if ! ${PW} show group ${SC_GROUP} -q >/dev/null; then
	gid=3689
	while ${PW} show group -g ${gid} -q >/dev/null; do
		gid=`expr ${gid} + 1`
	done
	if ! ${PW} add group ${SC_GROUP} -g ${gid}; then
		e=$?
		echo "*** Failed to add group \`${SC_GROUP}'. Please add it manually."
		exit ${e}
	fi
	echo "*** Added group \`${SC_GROUP}' (id ${gid})"
else
	gid=`${PW} show group ${SC_GROUP} 2>/dev/null | cut -d: -f3`
fi

if ! ${PW} show user ${SC_USER} -q >/dev/null; then
	uid=3689
	while ${PW} show user -u ${uid} -q >/dev/null; do
		uid=`expr ${uid} + 1`
	done
	if ! ${PW} add user ${SC_USER} -u ${uid} -g ${gid} -d "${SC_HOME}" \
	-c "daapd User" -s "${SC_SHELL}" -p "*" \
	; then
		e=$?
		echo "*** Failed to add user \`${SC_USER}'. Please add it manually."
		exit ${e}
	fi
	echo "*** Added user \`${SC_USER}' (id ${uid})"
else
	if ! ${PW} mod user ${SC_USER} -g ${gid} -d "${SC_HOME}" \
	-c "daapd User" -s "${SC_SHELL}" -p "*" \
	; then
		e=$?
		echo "*** Failed to update user \`${SC_USER}'."
		exit ${e}
	fi
		echo "*** Updated user \`${SC_USER}'."
fi