-
B>c       s   d  Z  d k Z d k Z d k Z d k Z d Z d Z d Z d Z d   Z	 d f  d     YZ
 d	   Z d
   Z d   Z d   Z d   Z d   Z e d j o e	   n d S(   s  %(program)s -- create a ZEO instance.

Usage: %(program)s home [port]

Given an "instance home directory" <home> and some configuration
options (all of which have default values), create the following:

<home>/etc/zeo.conf     -- ZEO config file
<home>/etc/zeoctl.conf  -- zdctl+zdrun config file
<home>/var/             -- Directory for data files: Data.fs etc.
<home>/log/             -- Directory for log files: zeo.log and zeoctl.log
<home>/bin/runzeo       -- the zeo server runner
<home>/bin/zeoctl       -- start/stop script (a shim for zdctl.py)

The script will not overwrite existing files; instead, it will issue a
warning if an existing file is found that differs from the file that
would be written if it didn't exist.
Nsq  # ZEO configuration file

%%define INSTANCE_HOME %(instance_home)s

<zeo>
  address %(port)d
  read-only false
  invalidation-queue-size 100
  # monitor-address PORT
  # transaction-timeout SECONDS
</zeo>

<filestorage 1>
  path $INSTANCE_HOME/var/Data.fs
</filestorage>

<eventlog>
  level info
  <logfile>
    path $INSTANCE_HOME/log/zeo.log
  </logfile>
</eventlog>
s  # %(package)sctl configuration file

%%define INSTANCE_HOME %(instance_home)s

<runner>
  program $INSTANCE_HOME/bin/runzeo
  socket-name $INSTANCE_HOME/etc/%(package)s.zdsock
  daemon true
  forever false
  backoff-limit 10
  exit-codes 0, 2
  directory $INSTANCE_HOME
  default-to-interactive true
  # user zope
  python %(python)s
  zdrun %(zope_home)s/zdaemon/zdrun.py
  # 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 $INSTANCE_HOME/log/%(package)s.log
</runner>

<eventlog>
  level info
  <logfile>
    path $INSTANCE_HOME/log/%(package)sctl.log
  </logfile>
</eventlog>
sc  #!/bin/sh
# %(PACKAGE)s instance start script

# The following two lines are for chkconfig.  On Red Hat Linux (and
# some other systems), you can copy or symlink this script into
# /etc/rc.d/init.d/ and then run chkconfig(8), to automatically start
# %(PACKAGE)s at boot time.

# chkconfig: 345 90 10
# description: start a %(PACKAGE)s server

PYTHON="%(python)s"
ZOPE_HOME="%(zope_home)s"
INSTANCE_HOME="%(instance_home)s"

CONFIG_FILE="$INSTANCE_HOME/etc/%(package)sctl.conf"

PYTHONPATH="$ZOPE_HOME"
export PYTHONPATH

ZDCTL="$ZOPE_HOME/zdaemon/zdctl.py"

exec "$PYTHON" "$ZDCTL" -C "$CONFIG_FILE" ${1+"$@"}
s8  #!/bin/sh
# %(PACKAGE)s instance start script

PYTHON="%(python)s"
ZOPE_HOME="%(zope_home)s"
INSTANCE_HOME="%(instance_home)s"

CONFIG_FILE="$INSTANCE_HOME/etc/%(package)s.conf"

PYTHONPATH="$ZOPE_HOME"
export PYTHONPATH

ZEO_RUN="$ZOPE_HOME/ZEO/runzeo.py"

exec "$PYTHON" "$ZEO_RUN" -C "$CONFIG_FILE" ${1+"$@"}
c      s   t    i   d GHd  S(   Ns	   All done.(   s   ZEOInstanceBuilders   run(    (    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/mkzeoinst.pys   main s    s   ZEOInstanceBuilderc      s#   t  Z d   Z d   Z d   Z RS(   Nc 
   s  y) t  i  t i d d d g  \ } } Wn* t  i j
 o } | GHt i d  n Xt i	 i
 t i d  } | o& t h  | d <} | GHt i   n t |  d d g j o d | GHt i d  n | d } t i	 i |  o t i	 i |  } n xP t i	 D]3 } t i	 i t i	 i | d   o | }	 Pn qWd	 GHt i d  | d o t | d  } n d
 } t |  |  i |	 | |  } |  i | |  d  S(   Ni   s   hs   helpi   i    s   programs   Usage: %s home [port]s   Zopes*   Can't find the Zope home (not in sys.path)i'  (   s   getopts   syss   argvs   optss   argss   errors   msgs   exits   oss   paths   basenames   programs   __doc__s   lens   instance_homes   isabss   abspaths   entrys   existss   joins	   zope_homes   ints   ports	   checkports   selfs
   get_paramss   paramss   create(
   s   selfs   argss   ports   programs   instance_homes   paramss   entrys   msgs   optss	   zope_home(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/mkzeoinst.pys   run s:    )	

 "	
c    sA   h  d d <d d <| d <| d <| d <t i d <Sd  S(	   Ns   zeos   packages   ZEOs   PACKAGEs	   zope_homes   instance_homes   ports   python(   s	   zope_homes   instance_homes   ports   syss
   executable(   s   selfs	   zope_homes   instance_homes   port(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/mkzeoinst.pys
   get_params s    c    s   t  |  t  | d  t  | d  t  | d  t  | d  t t | d d |  t t | d d |  t t | d d |  t t | d d |  d  S(	   Ns   etcs   vars   logs   bins   zeo.confs   zeoctl.confs   zeoctls   runzeo(	   s   makedirs   homes   makefiles   zeo_conf_templates   paramss   runner_conf_templates	   makexfiles   zdctl_templates   runzeo_template(   s   selfs   homes   params(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/mkzeoinst.pys   create s    
(   s   __name__s
   __module__s   runs
   get_paramss   create(    (    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/mkzeoinst.pys   ZEOInstanceBuilder s   	%	
c    su   d  k  } | i  | i | i  } y | i d |  f  Wn, | i j
 o d |  GHt i d  n X| i	   d  S(   Ns    s)   A process is already listening on port %di   (
   s   sockets   AF_INETs   SOCK_STREAMs   ss   binds   ports   errors   syss   exits   close(   s   ports   ss   socket(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/mkzeoinst.pys	   checkport s    		c    s   t  i d  } | i t  i  } x~ | D]v } t  i i | |   } t  i i
 |  o t  i | t  i  o2 t  i i |  o t  i i |  } n | Sn q( Wt d |  | f  d  S(   Ns   PATHs   can't find %r on path %r(   s   oss   getenvs   strpaths   splits   pathseps   binpaths   dirs   paths   joins   programs   isfiles   accesss   X_OKs   isabss   abspaths   IOError(   s   programs   binpaths   paths   dirs   strpath(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/mkzeoinst.pys   which s     )c     s>   d } x# |  D] } t i  i | |  } q Wt |  | Sd  S(   Ns    (   s   paths   argss   args   oss   joins   mkdirs(   s   argss   paths   arg(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/mkzeoinst.pys   makedir s     
c    s}   t  i i |   o d  Sn t  i i |   \ } } | o | o t  i i |  o t |  n t  i |   d G|  GHd  S(   Ns   Created directory(   s   oss   paths   isdirs   splits   heads   tails   mkdirss   mkdir(   s   paths   heads   tail(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/mkzeoinst.pys   mkdirs s    "c    s   t  | d    } t i i | | d  } |  | } t i i |  o[ t	 |  } | i   i   } | i   | o( | | i   j o d | GHn | Sn n t	 | d  } | i |  | i   d G| GH| Sd  S(   Nis)   Warning: not overwriting existing file %rs   ws
   Wrote file(   s   makedirs   argss   paths   oss   joins   templates   kwdss   datas   existss   opens   fs   reads   strips   olddatas   closes   write(   s   templates   argss   kwdss   olddatas   fs   paths   data(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/mkzeoinst.pys   makefile s     


	c    s   t  |  | |  } t i d  } t i |  d | @} t i	 t i |  t i
  | j o# t i | |  d | | f GHn | Sd  S(   Ni   i  s   Changed mode for %s to %o(   s   makefiles   templates   argss   kwdss   paths   oss   umasks   modes   stats   S_IMODEs   ST_MODEs   chmod(   s   templates   argss   kwdss   paths   modes   umask(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/mkzeoinst.pys	   makexfile s    &s   __main__(   s   __doc__s   oss   syss   stats   getopts   zeo_conf_templates   runner_conf_templates   zdctl_templates   runzeo_templates   mains   ZEOInstanceBuilders	   checkports   whichs   makedirs   mkdirss   makefiles	   makexfiles   __name__(   s   runner_conf_templates   zdctl_templates   stats   zeo_conf_templates	   checkports   makedirs   makefiles   mkdirss   syss   ZEOInstanceBuilders   whichs	   makexfiles   getopts   mains   oss   runzeo_template(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/mkzeoinst.pys   ?  s$   					<	
						
