blob: 4a394909eb751f47ba2f45f8df50ef4af22f3e49 (
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
63
64
65
66
67
68
69
70
71
72
|
#! /bin/sh
# This script is an adapted version of the pkg-install of the
# databases/postgresql7 port. (Wouldn't it be nice to have a
# target for making a user in bsd.port.mk or something similar?)
# $FreeBSD$
PATH=/bin:/usr/sbin:${LOCALBASE}/bin:
# set these if not provided by the Makefile
WEBWARE_USER=${WEBWARE_USER:-webkit}
WEBWARE_GROUP=${WEBWARE_USER:-webkit}
WEBWARE_MASTER_DIR=${STAGEDIR}${WEBWARE_MASTER_DIR:-${PKG_PREFIX}/share/webware}
WEBKIT_HOME_DIR=${STAGEDIR}${WEBKIT_HOME_DIR:-${PKG_PREFIX}/www/webkit}
add_webkit_account()
{
UID=108 # shouldn't be used for any other user!
GID=${UID}
if pw group show "${WEBWARE_GROUP}" 2>/dev/null; then
echo "You already have a group \"${WEBWARE_GROUP}\", so I will use it."
else
if pw groupadd ${WEBWARE_GROUP} -g ${GID}; then
echo "Added group \"${WEBWARE_GROUP}\"."
else
echo "Adding group \"${WEBWARE_GROUP}\" failed..."
exit 1
fi
fi
if pw user show "${WEBWARE_USER}" 2>/dev/null; then
echo "You already have a user \"${WEBWARE_USER}\", so I will use it."
else
if pw useradd ${WEBWARE_USER} -u ${UID} -g ${WEBWARE_GROUP} -h - \
-d ${WEBKIT_HOME_DIR} -c "WebKit Default User"
then
echo "Added user \"${WEBWARE_USER}\"."
else
echo "Adding user \"${WEBWARE_USER}\" failed..."
exit 1
fi
fi
}
compile_python_files()
{
(cd ${WEBWARE_MASTER_DIR} && ${PYTHON} install.py --no-password-prompt)
}
make_webkit_home_dir()
{
# make the default webware user home directory if it doesn't exist yet
if ! [ -d ${WEBKIT_HOME_DIR} ] ; then
# make application workdir for webkit user
${PYTHON} ${WEBWARE_MASTER_DIR}/bin/MakeAppWorkDir.py \
${WEBKIT_HOME_DIR}
fi
}
case $2 in
PRE-INSTALL)
add_webkit_account
;;
POST-INSTALL)
compile_python_files
if ! [ -f ${WEBKIT_HOME_DIR}/AppServer ] ; then
make_webkit_home_dir
fi
;;
esac
|