From b21f1895a09db5d7a020edd0ccb9f0e136421f85 Mon Sep 17 00:00:00 2001
From: Fred Drake <fdrake@acm.org>
Date: Mon, 17 Mar 2003 21:17:02 +0000
Subject: [PATCH] Always define INSTANCE in the generated files and refer to
 that, to make it easier to re-locate an instance.

---
 src/ZEO/mkzeoinst.py | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/ZEO/mkzeoinst.py b/src/ZEO/mkzeoinst.py
index fb37715f..3bb8ffd8 100755
--- a/src/ZEO/mkzeoinst.py
+++ b/src/ZEO/mkzeoinst.py
@@ -45,6 +45,8 @@ import getopt
 
 zeo_conf_template = """# ZEO configuration file
 
+%%define INSTANCE %(home)s
+
 <zeo>
   address %(port)d
   read-only false
@@ -54,40 +56,42 @@ zeo_conf_template = """# ZEO configuration file
 </zeo>
 
 <filestorage 1>
-  path %(home)s/var/Data.fs
+  path $INSTANCE/var/Data.fs
 </filestorage>
 
 <eventlog>
   level info
   <logfile>
-    path %(home)s/log/zeo.log
+    path $INSTANCE/log/zeo.log
   </logfile>
 </eventlog>
 """
 
 runner_conf_template = """# %(package)sctl configuration file
 
+%%define INSTANCE %(home)s
+
 <runner>
-  program %(server)s -C %(home)s/etc/%(package)s.conf
-  socket-name %(home)s/etc/%(package)s.zdsock
+  program %(server)s -C $INSTANCE/etc/%(package)s.conf
+  socket-name $INSTANCE/etc/%(package)s.zdsock
   daemon true
   forever false
   backoff-limit 10
   exit-codes 0, 2
-  directory %(home)s
+  directory $INSTANCE
   default-to-interactive true
   # user zope
   python %(python)s
   zdrun %(zdrun)s
   # This logfile should match the one in the %(package)s.conf file.
   # It is used by zdctl's logtail command, zdrun/zdctl doesn't write it.
-  logfile %(home)s/log/%(package)s.log
+  logfile $INSTANCE/log/%(package)s.log
 </runner>
 
 <eventlog>
   level info
   <logfile>
-    path %(home)s/log/%(package)sctl.log
+    path $INSTANCE/log/%(package)sctl.log
   </logfile>
 </eventlog>
 """
@@ -103,7 +107,9 @@ zdctl_template = """#!/bin/sh
 # chkconfig: 345 90 10
 # description: start a %(PACKAGE)s server
 
-exec %(zdctl)s -C %(home)s/etc/%(package)sctl.conf ${1+"$@"}
+INSTANCE='%(home)s'
+
+exec %(zdctl)s -C "$INSTANCE/etc/%(package)sctl.conf" ${1+"$@"}
 """
 
 def main():
-- 
2.30.9