--- /usr/sbin/zope-config.orig 2004-06-22 17:16:38.000000000 -0400 +++ /usr/sbin/zope-config 2004-06-23 10:46:39.740660281 -0400 @@ -37,11 +37,17 @@ zinst_security_setup() { - chown -R ${ZUID}:${2} ${1} - chmod -R g+u ${1} - chmod -R o-rwx ${1} - chown root ${1}/var/ # needed if $ZOPE_OPTS='-u root' - chmod +t ${1}/var/ + if [ ${ZOPE27} ] ; then + chown -R root:${2} ${1} + chmod -R o-rwx ${1} + chmod g+ws ${1}/{var,log} + else + chown -R ${ZUID}:${2} ${1} + chmod -R g+u ${1} + chmod -R o-rwx ${1} + chown root ${1}/var/ # needed if $ZOPE_OPTS='-u root' + chmod +t ${1}/var/ + fi } #Params: @@ -55,6 +61,9 @@ if [ "${#}" -lt 2 ] ; then # need a param RESULT=${E_PARAM} + elif [ ${ZOPE27} ] ; then + ${BIN}/mkzopeinstance.py --dir $2 + RESULT=$? else mkdir -p $2 || exit 1 if [ $(zinst_default_get >/dev/null)$? -ne 0 ] ; then @@ -94,6 +103,14 @@ if [ "${#}" -lt 3 ] ; then # need a param RESULT=${E_PARAM} + elif [ ${ZOPE27} ] ; then + install $1/skel/zope.initd ${INITD}/${3} + echo "INSTANCE_HOME=${2}" >${CONFD}/$3 + echo "EVENT_LOG_FILE=${EVENTLOGDIR}/${3}" >>${CONFD}/$3 + sed -i \ + -e "/^# *effective-user/ a\\effective-user ${ZUID}\\ " \ + ${2}/etc/zope.conf + RESULT=$? else install $1/.templates/zope.confd ${CONFD}/${3} install $1/.templates/zope.initd ${INITD}/${3} @@ -267,7 +284,7 @@ fi echo ">>> Create Zope inituser for \"$(basename ${ZINST_DIR})\"..." - /usr/bin/python ${ZSERV_DIR}/zpasswd.py ${ZINST_DIR}/inituser + /usr/bin/python ${BIN}/zpasswd.py ${ZINST_DIR}/inituser # If zpasswd is aborted it creates a blank inituser chown ${ZUID} ${ZINST_DIR}/inituser } @@ -289,6 +306,17 @@ exit ${E_SUCCESS} } +zserv_version_detect() +{ + if [ -d "${ZSERV_DIR}/bin" ] ; then + ZOPE27=1 + BIN=${ZSERV_DIR}/bin + else + ZOPE27=0 + BIN=${ZSERV_DIR} + fi +} + ##### Process the commandline while [ "$#" -gt 0 ] ; do @@ -298,7 +326,7 @@ esac case "$1" in - --zserv=*) ZSERV_DIR=${OPTARG} ;; + --zserv=*) ZSERV_DIR=${OPTARG} ; zserv_version_detect ;; --zinst=*) ZINST_DIR=${OPTARG} ;; --zgid=*) ZGID_NAME=${OPTARG} ;; --zidef-set) zinst_default_set ; exit $? ;; @@ -313,6 +341,7 @@ if [ -z ${ZSERV_DIR} ] ; then zserv_dir_get || { echo 'Canceled: zserv_dir_get' ; exit 1 ; } + zserv_version_detect fi if [ -z ${ZINST_DIR} ] ; then @@ -328,13 +357,18 @@ zinst_fs_setup ${ZSERV_DIR} ${ZINST_DIR} zinst_rc_setup ${ZSERV_DIR} ${ZINST_DIR} ${ZIRC_NAME} -groupadd ${ZGID_NAME} +! groupmod ${ZGID_NAME} >/dev/null 2>&1 && groupadd ${ZGID_NAME} # add existing user zope to the new group gpasswd -a zope ${ZGID_NAME} zinst_security_setup ${ZINST_DIR} ${ZGID_NAME} # TODO: see about adding interactive configuration of ZOPE_OPTS -echo "Note: Don\'t forget to edit ZOPE_OPTS in ${CONFD}${ZIRC_NAME}" -echo " (you might want to add -P 8{1,2,3,..}00 to set the zope ports offset)" - +if [ ${ZOPE27} ] ; then + echo "Note: Review settings in ${ZINST_DIR}/etc/zope.conf." + echo "Then you can start your new instance with:" + echo " /etc/init.d/${ZIRC_NAME} start" +else + echo "Note: Don\'t forget to edit ZOPE_OPTS in ${CONFD}${ZIRC_NAME}" + echo " (you might want to add -P 8{1,2,3,..}00 to set the zope ports offset)" +fi