blob: 5d77d7ed831227585a7f5f1fdd0a075feb0057ee (
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
54
55
56
57
58
59
|
#!/bin/sh
if [ -n "${PACKAGE_BUILDING}" ]; then
exit 0
fi
USER=avenger
GROUP=avenger
AVDIR=/var/spool/avenger
AVETC=${PKG_PREFIX}/etc/avenger
PW=/usr/sbin/pw
if [ "$2" = "PRE-INSTALL" ]; then
echo -n "Checking for group '$GROUP'... "
if ! ${PW} groupshow $GROUP >/dev/null 2>&1; then
echo -n "doesn't exist, adding... "
if ${PW} groupadd $GROUP; then
echo "success."
else
echo "FAILED!"
exit 1
fi
else
echo "exists."
fi
echo -n "Checking for user '$USER'... "
if ! ${PW} usershow $USER >/dev/null 2>&1; then
echo -n "doesn't exist, adding... "
if ${PW} useradd $USER -c 'Mail Avenger' -d "$AVDIR" -g $GROUP -s /sbin/nologin -h -; then
echo "success."
else
echo "FAILED!"
exit 1
fi
else
echo "exists."
fi
elif [ "$2" = "POST-INSTALL" ]; then
echo -n "Checking for config directory ($AVETC)... "
if [ -d "$AVETC" ]; then
echo "already exists."
else
echo -n "creating... "
if mkdir $AVETC; then
echo "success."
else
echo "FAILED!"
exit 1
fi
fi
fi
exit 0
|