summaryrefslogtreecommitdiff
path: root/sysutils/amanda-common/pkg/INSTALL
blob: 5c35dda233045d2d7f62c42aeb43fdbb328ff66b (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
#
# $NetBSD: INSTALL,v 1.4 2001/06/14 21:54:36 jlam Exp $

PKGNAME=$1
STAGE=$2

AMUSER=@AMUSER@
AMGROUP=@AMGROUP@
AMVAR=@AMVAR@
ADDUSER=@ADDUSER@
ADDGROUP=@ADDGROUP@
CHGRP="@CHGRP@"
CHMOD="@CHMOD@"
CHOWN="@CHOWN@"
ID="@ID@"
MKDIR="@MKDIR@"
RM="@RM@"
TOUCH="@TOUCH@"

case ${STAGE} in
PRE-INSTALL)
	# Group... the default's shipped with NetBSD
	# We need to check that ${AMGROUP} exists before adding the user.
	#
	${TOUCH} "/tmp/grouptestamanda.$$"
	${CHGRP} ${AMGROUP} "/tmp/grouptestamanda.$$" >/dev/null 2>&1
	if [ $? -eq 0 ]; then
		echo "Group '${AMGROUP}' already exists...proceeding."
	else
		echo "Creating '${AMGROUP}' group..."
		${ADDGROUP} ${AMGROUP}
		echo "Done."
	fi
	${RM} -f "/tmp/grouptestamanda.$$"

	${ID} ${AMUSER} >/dev/null 2>&1
	if [ $? -eq 0 ]; then
		echo "User '${AMUSER}' already exists...proceeding."
	else
		echo "Creating '${AMUSER}' user..."
		${ADDUSER} -c "Amanda User" -g ${AMGROUP} -s /bin/sh ${AMUSER}
		echo "Done."
	fi
	;;

POST-INSTALL)
	${MKDIR} ${AMVAR}
	${CHMOD} 700 ${AMVAR}
	${CHOWN} ${AMUSER}:${AMGROUP} ${AMVAR}

	${MKDIR} ${AMVAR}/gnutar-lists
	${CHMOD} 700 ${AMVAR}/gnutar-lists
	${CHOWN} ${AMUSER}:${AMGROUP} ${AMVAR}/gnutar-lists
	;;

*)
	echo "Unexpected argument: ${STAGE}"
	exit 1
	;;
esac
exit 0