#!/bin/sh ############################################################################## # # Script: make_ptk_site # # Purpose: Create an INSTANCE_HOME for a PTK-based site. # # Author: Tres Seaver, Digital Creations # # Date: 26 January 2001 # # Prerequisite: Either have existing Zope and PTK source, or have done # 'cvs -d :pserver:anonymous@cvs.zope.org:/cvs-repository login', # supplying 'anonymous' as the password. # # Environment: The script looks for several environment variables # # ZOPE_TAG CVS tag used to check out Zope from CVS. # # ZOPE_DIR Name of subdirectory into which to check out Zope. # # ZOPE_HOME Path to existing Zope installation; should have # 'lib/python' under it, with modules and shared # libraries already compiled. # # PTK_TAG CVS tag used to check out PTK from CVS. # # PTK_DIR Subdiretory into which to check out PTK from CVS. # # PTK_HOME Path to existing PTK installation; should have both # 'PTKBase' and 'PTKDemo' beneath it. # # MGR_ID User ID of the initial manager account. # # MGR_PWD Password of the initial manager account. # # SUPER_ID User ID of the initial manager account. # # SUPER_PWD Password of the initial manager account. # # Sample Usage: # # (default) $ mkdir ptktest; cd ptktest; ../make_ptk_site # # (use zope) $ mkdir ptktest; cd ptktest # $ ZOPE_HOME=/usr/local/zope/Zope-2.3-src ../make_ptk_site # ############################################################################## CURRENT=`pwd` CVSROOT=:pserver:anonymous@cvs.zope.org:/cvs-repository ZOPE_TAG=${ZOPE_TAG:=zope-2_3-branch} ZOPE_DIR=${ZOPE_DIR:=Zope-2.3-head} ZOPE_HOME=${ZOPE_HOME:=$CURRENT/$ZOPE_DIR} PTK_TAG=${PTK_TAG:=HEAD} PTK_DIR=${PTK_DIR:=ZopePTK-head} PTK_HOME=${PTK_HOME:=$CURRENT/$PTK_DIR} SUPER_ID=${SUPER_ID:=super} SUPER_PWD=${SUPER_PWD:=ch@ngeme} MGR_ID=${MGR_ID:=manager} MGR_PWD=${MGR_PWD:=ch@ngeme2} export CVSROOT ZOPE_TAG ZOPE_DIR PTK_TAG PTK_DIR CURRENT ZOPE_HOME export SUPER_ID SUPER_PWD MGR_ID MGR_PWD # # Get the head of the Zope 2.3 tree (as an export). This will # be our ZOPE_HOME # if [ -d $ZOPE_HOME ]; then echo Using existing Zope instance in "$ZOPE_HOME". else echo Exporting Zope using tag, "$ZOPE_TAG", to directory, "$ZOPE_DIR". /usr/bin/cvs export -r $ZOPE_TAG -d $ZOPE_DIR Zope2 echo Building Zope. cd $ZOPE_HOME /usr/bin/python wo_pcgi.py fi # # Get the head of the PTK tree (as an export). We will symlink # ZCallable, PTKBase, and PTKDemo from here. Call this one, # PTK_HOME. # # if [ -d $PTK_HOME ]; then echo Using existing Zope instance in "$PTK_HOME". else echo Exporting PTK using tag, "$PTK_TAG", to directory, "$PTK_DIR". /usr/bin/cvs export -r $PTK_TAG -d $PTK_DIR ZopePTK fi # # Set up INSTANCE_HOME products. # cd $CURRENT /bin/mkdir -p var import Extensions Products if [ ! -e $CURRENT/Products/PTKBase ]; then echo Symlinking $PTK_HOME/PTKBase into INSTANCE_HOME products. cd $CURRENT/Products ln -s $PTK_HOME/PTKBase . fi if [ ! -e $CURRENT/Products/PTKDemo ]; then echo Symlinking $PTK_HOME/PTKDemo into INSTANCE_HOME products. cd $CURRENT/Products ln -s $PTK_HOME/PTKDemo . fi # # Set up initial user files (manager and emergency). # if [ ! -e $CURRENT/inituser ]; then echo Building inituser file. cd $CURRENT echo /usr/bin/python $ZOPE_HOME/zpasswd.py -u $MGR_ID -p $MGR_PWD inituser /usr/bin/python $ZOPE_HOME/zpasswd.py -u $MGR_ID -p $MGR_PWD inituser fi if [ ! -e $CURRENT/access ]; then echo Building access file. cd $CURRENT echo /usr/bin/python $ZOPE_HOME/zpasswd.py -u $SUPER_ID -p $SUPER_PWD access /usr/bin/python $ZOPE_HOME/zpasswd.py -u $SUPER_ID -p $SUPER_PWD access fi # # Set up start and stop scripts. # if [ ! -e $CURRENT/zstart ]; then echo Creating zstart script. cd $CURRENT /bin/sed -e "s#XXXXX#$ZOPE_HOME#" > ./zstart <<- ZSTART #! /bin/sh reldir=\`dirname \$0\` PYTHONHOME=XXXXX SOFTWARE_HOME=\$PYTHONHOME/lib/python INSTANCE_HOME=\`cd \$reldir; pwd\` if [ -z "\$STUPID_LOG_FILE" ]; then STUPID_LOG_FILE="\$INSTANCE_HOME/var/stupid.log" export STUPID_LOG_FILE elif [ "\$STUPID_LOG_FILE"=="xxx" ]; then STUPID_LOG_FILE="" export STUPID_LOG_FILE fi export PYTHONHOME INSTANCE_HOME SOFTWARE_HOME STUPID_LOG_FILE exec /usr/bin/python \$PYTHONHOME/z2.py "\$@" ZSTART /bin/chmod 0711 zstart fi if [ ! -e $CURRENT/zstop ]; then echo Creating zstop script. cd $CURRENT /bin/cp $ZOPE_HOME/stop ./zstop /bin/chmod 0711 zstop fi