--- mkzopeinstance.py~ 2005-03-22 16:34:45.000000000 +0000 +++ mkzopeinstance.py 2005-03-22 16:34:46.000000000 +0000 @@ -22,6 +22,7 @@ -d/--dir -- the dir in which the instance home should be created -u/--user NAME:PASSWORD -- set the user name and password of the initial user -s/--skelsrc -- the dir from which skeleton files should be copied +-p/--portbase -- the port base which is added to all port numbers When run without arguments, this script will ask for the information necessary to create a Zope instance home. @@ -36,8 +37,8 @@ def main(): try: opts, args = getopt.getopt(sys.argv[1:], - "hu:d:s:", - ["help", "user=", "dir=", "skelsrc="] + "hu:d:s:p:", + ["help", "user=", "dir=", "skelsrc=", "portbase="] ) except getopt.GetoptError, msg: usage(sys.stderr, msg) @@ -48,6 +49,7 @@ password = None skeltarget = None skelsrc = None + portbase = None for opt, arg in opts: if opt in ("-d", "--dir"): @@ -71,6 +73,11 @@ usage(sys.stderr, "user must be specified as name:password") sys.exit(2) user, password = arg.split(":", 1) + if opt in ("-p", "--portbase"): + if not arg: + usage(sys.stderr, "portbase must not be empty") + sys.exit(2) + portbase = arg if not skeltarget: # interactively ask for skeltarget and initial user name/passwd. @@ -80,6 +87,10 @@ os.path.expanduser(get_skeltarget()) ) + if not portbase: + # interactively ask but default to 0 + portbase = get_portbase() + instancehome = skeltarget zopehome = os.path.dirname(os.path.dirname(script)) softwarehome = os.path.join(zopehome, "lib", "python") @@ -124,6 +135,7 @@ "INSTANCE_HOME": instancehome, "SOFTWARE_HOME": softwarehome, "ZOPE_HOME": zopehome, + "PORT_BASE": portbase, } ####Mennucc: use 'zope' user in Debian @@ -171,6 +183,15 @@ break return skeltarget +def get_portbase(): + print 'Please enter the base port number. Zope will add this to any' + print 'ports in the configuration file. This defaults to 0.' + print + portbase = raw_input("Port base: ").strip() + if portbase == '': + return 0 + return portbase + def get_inituser(): import getpass print 'Please choose a username and password for the initial user.'