summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2003-11-16 01:02:01 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2003-11-16 01:02:01 +0000
commit123ba4edcae185d7653029967f513916ce8fa0c8 (patch)
treef8ec847fd83aabd8038e220a5ddb069ea494114d /app-admin/zope-config
parentnew 0.2 version with lots of changes, partially thanks to solutions2u.net gmbd (diff)
downloadgentoo-2-123ba4edcae185d7653029967f513916ce8fa0c8.tar.gz
gentoo-2-123ba4edcae185d7653029967f513916ce8fa0c8.tar.bz2
gentoo-2-123ba4edcae185d7653029967f513916ce8fa0c8.zip
new 0.2 version with lots of changes, partially thanks to solutions2u.net gmbd
Diffstat (limited to 'app-admin/zope-config')
-rw-r--r--app-admin/zope-config/ChangeLog8
-rw-r--r--app-admin/zope-config/Manifest8
-rw-r--r--app-admin/zope-config/files/0.2/zope-config329
-rw-r--r--app-admin/zope-config/files/0.2/zope-config.conf29
-rw-r--r--app-admin/zope-config/files/digest-zope-config-0.20
-rw-r--r--app-admin/zope-config/metadata.xml5
-rw-r--r--app-admin/zope-config/zope-config-0.2.ebuild34
7 files changed, 409 insertions, 4 deletions
diff --git a/app-admin/zope-config/ChangeLog b/app-admin/zope-config/ChangeLog
index de3cf68ee1e9..6a6a7ad74afe 100644
--- a/app-admin/zope-config/ChangeLog
+++ b/app-admin/zope-config/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for app-admin/zope-config
# Copyright 2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-admin/zope-config/ChangeLog,v 1.5 2003/04/24 17:08:57 weeve Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-admin/zope-config/ChangeLog,v 1.6 2003/11/16 01:01:58 robbat2 Exp $
+
+*zope-config-0.2 (15 Nov 2003)
+
+ 15 Nov 2003; Robin H. Johnson <robbat2@gentoo.org> metadata.xml,
+ zope-config-0.2.ebuild, files/0.2/zope-config, files/0.2/zope-config.conf:
+ new 0.2 version with lots of changes, partially thanks to solutions2u.net gmbd
*zope-config-0.1-r1 (25 Feb 2003)
diff --git a/app-admin/zope-config/Manifest b/app-admin/zope-config/Manifest
index 5efb2ed23d72..8a03d92115e7 100644
--- a/app-admin/zope-config/Manifest
+++ b/app-admin/zope-config/Manifest
@@ -1,7 +1,9 @@
MD5 051defa9979f7abf00aaf52b8ed4a772 zope-config-0.1-r1.ebuild 527
-MD5 676cc92c2cae84cdd0dbd2464a6ca64c zope-config-0.2.ebuild 645
-MD5 82bc610daeeef2505b2ebd30033c66ff ChangeLog 937
+MD5 6b651f0ac5b58644651281970c59e1da zope-config-0.2.ebuild 979
+MD5 203ef91079026247260bd96e95eacbd1 ChangeLog 1196
+MD5 7890d88c5c6d189fbe6b187a3ebb6532 metadata.xml 161
MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-zope-config-0.2 0
MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-zope-config-0.1-r1 0
MD5 faf7b6954ed572c807bf7a574d44a377 files/0.1/zope-config 6875
-MD5 84c297da0cb12b21ab8e4a9f17cf911d files/0.2/zope-config 7380
+MD5 8373351a1405c09d9b34e605af90cc25 files/0.2/zope-config 7491
+MD5 fb05592b1acfc3c90480ed56ef3f86cb files/0.2/zope-config.conf 1047
diff --git a/app-admin/zope-config/files/0.2/zope-config b/app-admin/zope-config/files/0.2/zope-config
new file mode 100644
index 000000000000..d07e285b1460
--- /dev/null
+++ b/app-admin/zope-config/files/0.2/zope-config
@@ -0,0 +1,329 @@
+#!/bin/bash
+# vim: set noexpandtab ts=4:
+# Gentoo Zope Instance configure tool.
+#
+# Originally written by Jason Shoemaker <kutsuya@gentoo.org>
+# Portions by solution2u.net gmbh (Logging and some cleanups)
+# Portions by Robin Johnson <robbat2@gentoo.org> (Documentation and further cleanup)
+#
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/zope-config/files/0.2/zope-config,v 1.1 2003/11/16 01:01:59 robbat2 Exp $
+
+VERSION="0.2"
+
+CONFIGFILE=/etc/zope-config.conf
+if [ -e ${CONFIGFILE} ]; then
+ source ${CONFIGFILE}
+else
+ echo "Unable to find config file: ${CONFIGFILE}" 1>&2
+ exit 1
+fi
+
+# Return codes used in this program:
+E_SUCCESS=0
+E_FAILURE=1
+
+#E_ZPLIST=20
+E_ZILIST=22
+#E_COMMAND=24
+E_PARAM=26
+E_ZSLIST=28
+E_ZIDEFAULT=30
+
+#Parameters:
+# $1 = instance directory
+# $2 = group
+
+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/
+}
+
+#Params:
+# $1 = zserv dir
+# $2 = zinst dir
+
+zinst_fs_setup()
+{
+ local RESULT=${E_FAILURE}
+
+ if [ "${#}" -lt 2 ] ; then
+ # need a param
+ RESULT=${E_PARAM}
+ else
+ mkdir -p $2 || exit 1
+ if [ $(zinst_default_get >/dev/null)$? -ne 0 ] ; then
+ echo $(basename ${ZINST_DIR}) >${ZI_DIR}/.default
+ chown zope:root ${ZI_DIR}/.default
+ fi
+ cp -R $1/.templates/Extensions $2
+ cp -R $1/.templates/import $2
+ cp -R $1/.templates/var $2
+ mkdir $2/Products
+ RESULT=$?
+ fi
+
+ return ${RESULT}
+}
+
+#Params:
+# $1 = zserv dir
+# $2 = zinst dir
+# $3 = zinst name
+
+zinst_rc_setup()
+{
+ local RESULT=${E_FAILURE}
+
+ if [ "${#}" -lt 3 ] ; then
+ # need a param
+ RESULT=${E_PARAM}
+ else
+ install $1/.templates/zope.confd ${CONFD}/${3}
+ install $1/.templates/zope.initd ${INITD}/${3}
+ sed -i \
+ -e "/INSTANCE_HOME=/ c\\INSTANCE_HOME=${2}\\ " \
+ -e "/CLIENT_HOME=/ c\\CLIENT_HOME=${2}/var\\ " \
+ -e "/EVENT_LOG_FILE=/ c\\EVENT_LOG_FILE=${EVENTLOGDIR}\/${3}\\ " \
+ ${CONFD}/${3}
+ RESULT=$?
+ # make sure the directory exists
+ mkdir -p ${EVENTLOGDIR} >/dev/null 2>&1
+ fi
+ return ${RESULT}
+}
+
+#
+
+zserv_dir_get()
+{
+ local RESULT=${E_FAILURE}
+ local LIST=$(ls ${ZS_DIR})
+ local LIST_CNT=$(echo ${LIST} | wc -w)
+ local DLIST=
+
+ # Assume that LIST_TMP contains valid zserver dirs.
+ if [ ${LIST_CNT} -eq 1 ] ; then
+ ZSERV_DIR=${LIST}
+ RESULT=${E_SUCCESS}
+ elif [ ${LIST_CNT} -ne 0 ] ; then
+ for N in ${LIST} ; do
+ DLIST="${DLIST} $N -"
+ done
+ ZSERV_DIR=$(dialog --stdout \
+ --title "Zope Server List" \
+ --menu "Select desired zserver: " 0 0 ${LIST_CNT} ${DLIST})
+ RESULT=$?
+ else
+ RESULT=${E_ZSLIST} # There are no zservers
+ fi
+ ZSERV_DIR="${ZS_DIR}${ZSERV_DIR}"
+ return ${RESULT}
+}
+
+#
+
+zinst_dir_set()
+{
+ local RESULT=
+
+ if [ ! -d ${ZI_DIR} ] ; then
+ mkdir -p ${ZI_DIR}
+ fi
+
+ while : ; do
+ ZINST_DIR=$(dialog --stdout \
+ --backtitle "Need a uniqe name for zinstance directory.(Also the name of the rcscript.)" \
+ --inputbox "Enter a new zinstance name:" 0 0 )
+ RESULT=$?
+ if [ ${RESULT} -ne 0 ] ; then
+ break
+ elif [ -z ${ZINST_DIR} ] ; then
+ dialog --msgbox "Error: need a name." 0 0
+ continue
+ elif echo ${ZINST_DIR} |grep "/" ; then
+ dialog --msgbox "Error: ${ZINST_DIR} is a path, not a name." 0 0
+ continue
+ elif [[ -d "${ZI_DIR}${ZINST_DIR}" && \
+ -f "${INITD}/${ZINST_DIR}" ]] ; then
+ dialog --msgbox "Error: ${ZINST_DIR} zinstance already exists." 0 0
+ continue
+ fi
+ ZINST_DIR=${ZI_DIR}${ZINST_DIR}
+ break
+ done
+ return ${RESULT}
+}
+
+#
+
+zinst_dir_get()
+{
+ local RESULT=1
+ local LIST=$(ls ${ZI_DIR})
+ local LIST_CNT=$(echo ${LIST} | wc -w)
+ local DLIST=
+
+ # Assume that LIST_TMP contains valid zinstance dirs.
+ if [ ${LIST_CNT} -eq 1 ] ; then
+ ZINST_DIR=${LIST}
+ RESULT=${E_SUCCESS}
+ elif [ ${LIST_CNT} -ne 0 ] ; then
+ for N in ${LIST} ; do
+ DLIST="${DLIST} $N -"
+ done
+ ZINST_DIR=$(dialog --stdout \
+ --title "Zope Instance List" \
+ --menu "Select desired zinstance:" 0 0 ${LIST_CNT} ${DLIST})
+ RESULT=$?
+ else
+ RESULT=${E_ZILIST} # There are no zinstances
+ fi
+ ZINST_DIR="${ZI_DIR}${ZINST_DIR}"
+ return ${RESULT}
+}
+
+#
+
+zinst_default_set()
+{
+ local RESULT=
+
+ zinst_dir_get
+ RESULT=$?
+ if [ ${RESULT} -eq 0 ] ; then
+ echo $(basename ${ZINST_DIR}) >${ZI_DIR}/.default
+ chown zope ${ZI_DIR}/.default
+ fi
+
+ return ${RESULT}
+}
+
+# Echos the default directory that this instance was created in
+
+zinst_default_get()
+{
+ local RESULT=${E_ZIDEFAULT}
+
+ if [ -s ${ZI_DIR}/.default ] ; then
+ cat ${ZI_DIR}/.default
+ RESULT=$? # use to be 0
+ fi
+ return ${RESULT}
+}
+
+# Gets a name for the group that owns the new zinstance and also creates the
+# group if nessicary
+
+zinst_zgid_set()
+{
+ local RESULT=
+ while : ; do
+ ZGID_NAME=$(dialog --stdout \
+ --backtitle "Need to create/assign a zinstance group name." \
+ --inputbox "Enter a group name:" \
+ 0 0 $(basename ${ZIRC_NAME}))
+ RESULT=$?
+ if [ ${RESULT} -ne 0 ] ; then
+ break
+ elif [ -z ${ZGID_NAME} ] ; then
+ dialog --msgbox "Error: empty string." 0 0
+ continue
+ elif groupmod ${ZGID_NAME} >/dev/null 2>&1 ; then
+ dialog --yesno "${ZGID_NAME} already exists, use it?" 0 0
+ RESULT=$?
+ [ ${RESULT} -ne 0 ] && continue
+ fi
+ break
+ done
+ return ${RESULT}
+}
+
+# Sets the inituser password for a given zinstance
+
+zinst_zpasswd_set()
+{
+ if [ -z ${ZSERV_DIR} ] ; then
+ zserv_dir_get || { exit $? ; }
+ fi
+ if [ -z ${ZINST_DIR} ] ; then
+ zinst_dir_get || exit $?
+ fi
+
+ echo ">>> Create Zope inituser for \"$(basename ${ZINST_DIR})\"..."
+ /usr/bin/python ${ZSERV_DIR}/zpasswd.py ${ZINST_DIR}/inituser
+ # If zpasswd is aborted it creates a blank inituser
+ chown ${ZUID} ${ZINST_DIR}/inituser
+}
+
+# help!
+
+usage()
+{
+ echo "$(basename $0) version ${VERSION}"
+ echo "A Gentoo Zope Instance configure tool."
+ echo
+ echo "Interactive usage:"
+ echo -e "\t$(basename $0)"
+ echo "Partial interactive usage:"
+ echo -e "\t$(basename $0) --[zserv=[dir] &| zinst=[dir] &| zgid=[name]]"
+ echo "Non-interactive usage:"
+ echo -e "\t$(basename $0) --[zidef-get | zidef-set | zpasswd | version | help]"
+ echo -e "\t$(basename $0) --[zserv=[dir] & zinst=[dir] & zgid=[name]]"
+ exit ${E_SUCCESS}
+}
+
+##### Process the commandline
+
+while [ "$#" -gt 0 ] ; do
+ case "$1" in
+ -*=*) OPTARG=$(echo "$1" | sed 's/[-_a-zA-Z0-9]*=//') ;;
+ *) OPTARG= ;;
+ esac
+
+ case "$1" in
+ --zserv=*) ZSERV_DIR=${OPTARG} ;;
+ --zinst=*) ZINST_DIR=${OPTARG} ;;
+ --zgid=*) ZGID_NAME=${OPTARG} ;;
+ --zidef-set) zinst_default_set ; exit $? ;;
+ --zidef-get) zinst_default_get ; exit $? ;;
+ --zpasswd) zinst_zpasswd_set ; exit $? ;;
+ --version) echo ${VERSION} ; exit 0 ;;
+ -*) usage ; exit 0 ;;
+ *) usage ; exit 0 ;;
+ esac
+ shift
+done
+
+if [ -z ${ZSERV_DIR} ] ; then
+ zserv_dir_get || { echo 'Canceled: zserv_dir_get' ; exit 1 ; }
+fi
+
+if [ -z ${ZINST_DIR} ] ; then
+ zinst_dir_set || { echo 'Canceled: zinst_dir_set' ; exit 1 ; }
+fi
+
+[ -z ${ZIRC_NAME} ] && ZIRC_NAME=$(basename ${ZINST_DIR})
+
+if [ -z ${ZGID_NAME} ] ; then
+ zinst_zgid_set || { echo 'Canceled: zinst_zgid_set' ; exit 1 ; }
+fi
+
+zinst_fs_setup ${ZSERV_DIR} ${ZINST_DIR}
+zinst_rc_setup ${ZSERV_DIR} ${ZINST_DIR} ${ZIRC_NAME}
+
+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)"
+
diff --git a/app-admin/zope-config/files/0.2/zope-config.conf b/app-admin/zope-config/files/0.2/zope-config.conf
new file mode 100644
index 000000000000..4ca33cac8894
--- /dev/null
+++ b/app-admin/zope-config/files/0.2/zope-config.conf
@@ -0,0 +1,29 @@
+# vim: set noexpandtab ts=4 ft=sh:
+# Gentoo Zope Instance configure tool config file.
+#
+# Originally written by Jason Shoemaker <kutsuya@gentoo.org>
+# Portions by solution2u.net gmbh (Logging and some cleanups)
+# Portions by Robin Johnson <robbat2@gentoo.org> (Documentation and further cleanup)
+#
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/zope-config/files/0.2/zope-config.conf,v 1.1 2003/11/16 01:01:59 robbat2 Exp $
+
+# default name for new instances
+DEFAULT_ZINSTANCENAME="zope-"
+
+# Logging directory
+EVENTLOGDIR="/var/log/zope/"
+
+# you probably shouldn't change anything below this
+# -------------------------------------------------
+# Name of zope user on your system
+ZUID=zope
+# This is where the real zope lives
+ZS_DIR="/usr/share/zope/"
+# This is where we will put our new instance of zope
+ZI_DIR="/var/lib/zope/"
+# place for init script
+# and it's associated configuration file
+INITD="/etc/init.d/"
+CONFD="/etc/conf.d/"
diff --git a/app-admin/zope-config/files/digest-zope-config-0.2 b/app-admin/zope-config/files/digest-zope-config-0.2
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/app-admin/zope-config/files/digest-zope-config-0.2
diff --git a/app-admin/zope-config/metadata.xml b/app-admin/zope-config/metadata.xml
new file mode 100644
index 000000000000..46c8eea1b318
--- /dev/null
+++ b/app-admin/zope-config/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>net-zope</herd>
+</pkgmetadata>
diff --git a/app-admin/zope-config/zope-config-0.2.ebuild b/app-admin/zope-config/zope-config-0.2.ebuild
new file mode 100644
index 000000000000..16fd35b06647
--- /dev/null
+++ b/app-admin/zope-config/zope-config-0.2.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/zope-config/zope-config-0.2.ebuild,v 1.1 2003/11/16 01:01:59 robbat2 Exp $
+
+DESCRIPTION="A Gentoo Zope multi-Instance configure tool"
+SRC_URI=""
+HOMEPAGE="http://www.gentoo.org/"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~ppc ~sparc ~arm ~alpha ~hppa ~ia64 ~amd64 ~mips"
+DEPEND=""
+RDEPEND=">=dev-util/dialog-0.7
+ sys-apps/grep
+ sys-apps/sed
+ sys-apps/shadow
+ dev-lang/python
+ sys-apps/coreutils
+ >=net-zope/zope-2.6.0-r2"
+
+src_install() {
+ # the script
+ dosbin ${FILESDIR}/${PV}/zope-config
+ # config file
+ insinto /etc
+ doins ${FILESDIR}/${PV}/zope-config.conf
+ # ensure this directory exists
+ keepdir /var/log/zope
+}
+
+pkg_postinst() {
+ source ${FILESDIR}/${PV}/zope-config.conf
+ einfo "Please note that new instances now log into ${EVENTLOGDIR}"
+ einfo "Please see the configuration file /etc/zope-config.conf"
+}