openbsd-ports/www/zope/files/zope-instance
matt 26911033e4 - update to 2.4.2
- regress
- add zope-instance relative path support
- do optimizing compile on python files too, like lang/python, and use optimized in default zope-instance start script
2001-11-02 03:35:11 +00:00

66 lines
1.8 KiB
Python
Executable File

#!@@LOCALBASE@@/bin/python2.1
#
# $OpenBSD: zope-instance,v 1.3 2001/11/02 03:35:11 matt Exp $
#
# Build a Zope INSTANCE_HOME in the specified directory.
#
# Run this script as the user who will be owning this Zope installation.
# The instance directory must already exist, and be empty.
#
# Matt Behrens <matt@openbsd.org>
#
zopehome="@@PREFIX@@/lib/zope"
import os, shutil, sys
if len(sys.argv) != 2:
print "usage: %s instance-directory" % sys.argv[0]
sys.exit(0)
instancehome=os.path.abspath(sys.argv[1])
for directory in ("import", "var", "Extensions", "Products"):
os.mkdir(os.path.join(instancehome, directory))
# Copy the initial Data.fs
datafs = "%s/var/Data.fs" % instancehome
shutil.copyfile("%s/var/Data.fs.in" % zopehome, datafs)
os.chmod(datafs, 0600)
# Import installation modules
sys.path.insert(0, zopehome)
sys.path.insert(0, "%s/inst" % zopehome)
import make_start, zpasswd
python=sys.executable
# Create Zope.cgi
open("%s/Zope.cgi" % instancehome, "w").write(
"""#!%(zopehome)s/pcgi/pcgi-wrapper
PCGI_NAME=Zope
PCGI_MODULE_PATH=%(zopehome)s/lib/python/Zope
PCGI_PUBLISHER=%(zopehome)s/pcgi/pcgi_publisher.py
PCGI_EXE=%(python)s
PCGI_SOCKET_FILE=%(instancehome)s/var/pcgi.soc
PCGI_PID_FILE=%(instancehome)s/var/pcgi.pid
PCGI_ERROR_LOG=%(instancehome)s/var/pcgi.log
PCGI_DISPLAY_ERRORS=1
BOBO_REALM=%(instancehome)s/Zope.cgi
BOBO_DEBUG_MODE=1
INSTANCE_HOME=%(instancehome)s
""" % vars())
os.chmod("%s/Zope.cgi" % instancehome, 04750)
# Create start and stop scripts
make_start.sh(instancehome, '', '')
open("%s/start" % instancehome, "w").write(
"""#!/bin/sh
export INSTANCE_HOME=%(instancehome)s
export PYTHONHOME=%(zopehome)s
exec %(python)s -O $PYTHONHOME/z2.py -D "$@" -p %(instancehome)s/Zope.cgi
""" % vars())
# Create the admin user
zpasswd.write_inituser(instancehome, '', '')