blob: f84758aa9366476dd2c583dea4e7e849f912f2c9 (
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
|
#!/bin/sh
# $FreeBSD$
DEST_DIR=${PKG_DESTDIR:-}
HAVP_USER=havp
HAVP_GROUP=havp
LOG_DIR=$DEST_DIR%%LOG_DIR%%
TMP_DIR=$DEST_DIR%%TMP_DIR%%
RUN_DIR=$DEST_DIR%%RUN_DIR%%
if [ "$2" = "PRE-INSTALL" ]; then
if ! pw groupshow "$HAVP_GROUP" 2>/dev/null 1>&2; then
if pw groupadd $HAVP_GROUP; then
echo "=> Added group \"$HAVP_GROUP\"."
else
echo "=> Adding group \"$HAVP_GROUP\" failed..."
exit 1
fi
fi
if ! pw usershow "$HAVP_USER" 2>/dev/null 1>&2; then
if pw useradd $HAVP_USER -g $HAVP_GROUP -h - \
-s "/sbin/nologin" -d "/nonexistent" \
-c "havp daemon"; \
then
echo "=> Added user \"$HAVP_USER\"."
else
echo "=> Adding user \"$HAVP_USER\" failed..."
exit 1
fi
fi
elif [ "$2" = "POST-INSTALL" ]; then
if [ ! -d "$LOG_DIR" ]; then
mkdir -p "$LOG_DIR" || exit 1
chown "$HAVP_USER:$HAVP_GROUP" "$LOG_DIR" || exit 1
fi
if [ ! -d "$TMP_DIR" ]; then
mkdir -p "$TMP_DIR" || exit 1
chown "$HAVP_USER:$HAVP_GROUP" "$TMP_DIR" || exit 1
fi
if [ ! -d "$RUN_DIR" ]; then
mkdir -p "$RUN_DIR" || exit 1
chown "$HAVP_USER:$HAVP_GROUP" "$RUN_DIR" || exit 1
fi
fi
exit 0
|