blob: e677774c5ee9199eb61df137bf8cdd2ee0cd353e (
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#! /bin/sh
PREFIX=${PKG_PREFIX:-%%PREFIX%%}
VCHATUSER=%%VCHATUSER%%
VCHATGROUP=%%VCHATGROUP%%
UID=128
GID=128
if [ -n "%%DESTDIR%%" ]; then
PW="/usr/sbin/chroot %%DESTDIR%% pw"
CHOWN="/usr/sbin/chroot %%DESTDIR%% chown"
CHMOD="/usr/sbin/chroot %%DESTDIR%% chmod"
MKDIR="/usr/sbin/chroot %%DESTDIR%% mkdir -p"
else
PW="pw"
CHOWN="chown"
CHMOD="chmod"
MKDIR="mkdir"
fi
if [ "$2" = "PRE-INSTALL" ]; then
if ! ${PW} groupshow ${VCHATGROUP} 2>/dev/null 1>&2; then
if ${PW} groupadd ${VCHATGROUP} -g $GID; then
echo "=> Added group \"${VCHATGROUP}\"."
else
echo "=> Adding group \"${VCHATGROUP}\" failed."
exit 1
fi
fi
if ! ${PW} usershow ${VCHATUSER} 2>/dev/null 1>&2; then
if ${PW} useradd ${VCHATUSER} -u $UID -g ${VCHATGROUP} -h - \
-s "/sbin/nologin" -d "/nonexistent" \
-c "VChat Conferencing System"; \
then
echo "=> Added user \"${VCHATUSER}\"."
else
echo "=> Adding user \"${VCHATUSER}\" failed."
exit 1
fi
fi
elif [ "$2" = "POST-INSTALL" ]; then
if [ ! -d "${PREFIX}/etc/vchat" ]; then
${MKDIR} ${PREFIX}/etc/vchat || exit 1
fi
${CHOWN} ${VCHATUSER}:${VCHATGROUP} ${PREFIX}/etc/vchat
${CHMOD} 755 ${PREFIX}/etc/vchat
if [ ! -f "${PREFIX}/etc/vchat/user.db" ]; then
cat << -EOT-
****************************** IMPORTANT NOTE *******************************
Before starting vserver into normal operations for the first time, you
need to create an initial user database file "${PREFIX}/etc/vchat/user.db".
This is accomplished by running the following command sequence:
su -f -m ${VCHATUSER} -c "${PREFIX}/sbin/vserver /BASEDIR=${PREFIX}/etc/vchat /CREATEUDB"
*****************************************************************************
-EOT-
else
${CHOWN} ${VCHATUSER}:${VCHATGROUP} ${PREFIX}/etc/vchat/user.db
${CHMOD} 600 ${PREFIX}/etc/vchat/user.db
fi
fi
exit 0
|