Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 41508 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/sbin/zope-config.orig (-11 / +45 lines)
Lines 37-47 Link Here
37
37
38
zinst_security_setup()
38
zinst_security_setup()
39
{
39
{
40
	chown -R ${ZUID}:${2} ${1}
40
	if [ ${ZOPE27} ] ; then
41
	chmod -R g+u ${1}
41
		chown -R root:${2} ${1}
42
	chmod -R o-rwx ${1}
42
		chmod -R o-rwx ${1}
43
	chown root ${1}/var/   # needed if $ZOPE_OPTS='-u root'
43
		chmod g+ws ${1}/{var,log}
44
	chmod +t ${1}/var/
44
	else
45
		chown -R ${ZUID}:${2} ${1}
46
		chmod -R g+u ${1}
47
		chmod -R o-rwx ${1}
48
		chown root ${1}/var/   # needed if $ZOPE_OPTS='-u root'
49
		chmod +t ${1}/var/
50
	fi
45
}
51
}
46
52
47
#Params:
53
#Params:
Lines 55-60 Link Here
55
	if [ "${#}" -lt 2 ] ; then
61
	if [ "${#}" -lt 2 ] ; then
56
		# need a param
62
		# need a param
57
		RESULT=${E_PARAM}
63
		RESULT=${E_PARAM}
64
	elif [ ${ZOPE27} ] ; then
65
		${BIN}/mkzopeinstance.py --dir $2
66
		RESULT=$?
58
	else
67
	else
59
		mkdir -p $2 || exit 1
68
		mkdir -p $2 || exit 1
60
		if [ $(zinst_default_get >/dev/null)$? -ne 0 ] ; then
69
		if [ $(zinst_default_get >/dev/null)$? -ne 0 ] ; then
Lines 94-99 Link Here
94
	if [ "${#}" -lt 3 ] ; then
103
	if [ "${#}" -lt 3 ] ; then
95
		# need a param
104
		# need a param
96
		RESULT=${E_PARAM}
105
		RESULT=${E_PARAM}
106
	elif [ ${ZOPE27} ] ; then
107
		install $1/skel/zope.initd ${INITD}/${3}
108
		echo "INSTANCE_HOME=${2}" >${CONFD}/$3
109
		echo "EVENT_LOG_FILE=${EVENTLOGDIR}/${3}" >>${CONFD}/$3
110
		sed -i \
111
			-e "/^# *effective-user/ a\\effective-user ${ZUID}\\ " \
112
			${2}/etc/zope.conf
113
		RESULT=$?
97
	else
114
	else
98
		install $1/.templates/zope.confd ${CONFD}/${3}
115
		install $1/.templates/zope.confd ${CONFD}/${3}
99
		install $1/.templates/zope.initd ${INITD}/${3}
116
		install $1/.templates/zope.initd ${INITD}/${3}
Lines 267-273 Link Here
267
	fi
284
	fi
268
285
269
	echo ">>> Create Zope inituser for \"$(basename ${ZINST_DIR})\"..."
286
	echo ">>> Create Zope inituser for \"$(basename ${ZINST_DIR})\"..."
270
	/usr/bin/python ${ZSERV_DIR}/zpasswd.py ${ZINST_DIR}/inituser
287
	/usr/bin/python ${BIN}/zpasswd.py ${ZINST_DIR}/inituser
271
	# If zpasswd is aborted it creates a blank inituser
288
	# If zpasswd is aborted it creates a blank inituser
272
	chown ${ZUID} ${ZINST_DIR}/inituser
289
	chown ${ZUID} ${ZINST_DIR}/inituser
273
}
290
}
Lines 289-294 Link Here
289
	exit ${E_SUCCESS}
306
	exit ${E_SUCCESS}
290
}
307
}
291
308
309
zserv_version_detect()
310
{
311
	if [ -d "${ZSERV_DIR}/bin" ] ; then
312
		ZOPE27=1
313
		BIN=${ZSERV_DIR}/bin
314
	else
315
		ZOPE27=0
316
		BIN=${ZSERV_DIR}
317
	fi
318
}
319
292
##### Process the commandline
320
##### Process the commandline
293
321
294
while [ "$#" -gt 0 ] ; do
322
while [ "$#" -gt 0 ] ; do
Lines 298-304 Link Here
298
	esac
326
	esac
299
327
300
	case "$1" in
328
	case "$1" in
301
	--zserv=*) ZSERV_DIR=${OPTARG} ;;
329
	--zserv=*) ZSERV_DIR=${OPTARG} ; zserv_version_detect ;;
302
	--zinst=*) ZINST_DIR=${OPTARG} ;;
330
	--zinst=*) ZINST_DIR=${OPTARG} ;;
303
	--zgid=*)  ZGID_NAME=${OPTARG} ;;
331
	--zgid=*)  ZGID_NAME=${OPTARG} ;;
304
	--zidef-set) zinst_default_set ; exit $? ;;
332
	--zidef-set) zinst_default_set ; exit $? ;;
Lines 313-318 Link Here
313
341
314
if [ -z ${ZSERV_DIR} ] ; then
342
if [ -z ${ZSERV_DIR} ] ; then
315
	zserv_dir_get || { echo 'Canceled: zserv_dir_get' ; exit 1 ; }
343
	zserv_dir_get || { echo 'Canceled: zserv_dir_get' ; exit 1 ; }
344
	zserv_version_detect
316
fi
345
fi
317
346
318
if [ -z ${ZINST_DIR} ] ; then
347
if [ -z ${ZINST_DIR} ] ; then
Lines 328-340 Link Here
328
zinst_fs_setup ${ZSERV_DIR} ${ZINST_DIR}
357
zinst_fs_setup ${ZSERV_DIR} ${ZINST_DIR}
329
zinst_rc_setup ${ZSERV_DIR} ${ZINST_DIR} ${ZIRC_NAME}
358
zinst_rc_setup ${ZSERV_DIR} ${ZINST_DIR} ${ZIRC_NAME}
330
359
331
groupadd ${ZGID_NAME}
360
! groupmod ${ZGID_NAME} >/dev/null 2>&1 && groupadd ${ZGID_NAME}
332
# add existing user zope to the new group
361
# add existing user zope to the new group
333
gpasswd -a zope ${ZGID_NAME}
362
gpasswd -a zope ${ZGID_NAME}
334
363
335
zinst_security_setup ${ZINST_DIR} ${ZGID_NAME}
364
zinst_security_setup ${ZINST_DIR} ${ZGID_NAME}
336
365
337
# TODO: see about adding interactive configuration of ZOPE_OPTS
366
# TODO: see about adding interactive configuration of ZOPE_OPTS
338
echo "Note: Don\'t forget to edit ZOPE_OPTS in ${CONFD}${ZIRC_NAME}"
367
if [ ${ZOPE27} ] ; then
339
echo "      (you might want to add -P 8{1,2,3,..}00 to set the zope ports offset)"
368
	echo "Note: Review settings in ${ZINST_DIR}/etc/zope.conf."
340
369
	echo "Then you can start your new instance with:"
370
	echo "	/etc/init.d/${ZIRC_NAME} start"
371
else
372
	echo "Note: Don\'t forget to edit ZOPE_OPTS in ${CONFD}${ZIRC_NAME}"
373
	echo "      (you might want to add -P 8{1,2,3,..}00 to set the zope ports offset)"
374
fi

Return to bug 41508