~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to setup/configure.py

Reimplement setup/buildjail.sh in Python. This means that sites can configure
additional repositories and packages to include in the jail, without modifying
the source tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
1
# IVLE - Informatics Virtual Learning Environment
3
2
# Copyright (C) 2007-2009 The University of Melbourne
4
3
#
16
15
# along with this program; if not, write to the Free Software
17
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
17
 
 
18
# Module: setup/config
19
19
# Author: Matt Giuca, Refactored by David Coles
 
20
# Date:   03/07/2008
20
21
 
21
22
'''Configures IVLE with machine-specific details, most notably, various paths.
22
23
Either prompts the administrator for these details or accepts them as
23
24
command-line args.
24
25
 
25
 
Creates etc/ivle.conf
 
26
Creates ivle/conf/conf.py and bin/trampoline/trampoline/conf.h.
26
27
'''
27
28
 
28
29
import optparse
29
30
import getopt
30
31
import os
31
32
import sys
32
 
import stat
33
33
import hashlib
34
34
import uuid
35
35
 
36
 
import ivle.config
 
36
from setup.util import query_user
37
37
 
38
38
import configobj
39
39
 
 
40
# This dict maps legacy config option names to new config option paths
 
41
# ('section/option_name')
 
42
# NOTE: This is copied from ivle/conf/conf.py (because neither of these files
 
43
# can see each other).
 
44
CONFIG_OPTIONS = {
 
45
    'root_dir': 'urls/root',
 
46
    'prefix': 'paths/prefix',
 
47
    'data_path': 'paths/data',
 
48
    'log_path': 'paths/logs',
 
49
    'python_site_packages_override': 'paths/site_packages',
 
50
    'public_host': 'urls/public_host',
 
51
    'allowed_uids': 'os/allowed_uids',
 
52
    'db_host': 'database/host',
 
53
    'db_port': 'database/port',
 
54
    'db_dbname': 'database/name',
 
55
    'db_forumdbname': 'plugins/forum/dbname',
 
56
    'db_user': 'database/username',
 
57
    'db_password': 'database/password',
 
58
    'auth_modules': 'auth/modules',
 
59
    'ldap_url': 'auth/ldap_url',
 
60
    'ldap_format_string': 'auth/ldap_format_string',
 
61
    'subject_pulldown_modules': 'auth/subject_pulldown_modules',
 
62
    'svn_addr': 'urls/svn_addr',
 
63
    'usrmgt_host': 'usrmgt/host',
 
64
    'usrmgt_port': 'usrmgt/port',
 
65
    'usrmgt_magic': 'usrmgt/magic',
 
66
    'forum_secret': 'plugins/forum/secret',
 
67
}
 
68
 
40
69
class ConfigOption:
41
70
    """A configuration option; one of the things written to conf.py."""
42
71
    def __init__(self, option_name, default, prompt, comment, ask=True):
59
88
# Configuration options, defaults and descriptions
60
89
config_options = []
61
90
 
62
 
config_options.append(ConfigOption("urls/root", "/",
 
91
config_options.append(ConfigOption("root_dir", "/",
63
92
    """Root directory where IVLE is located (in URL space):""",
64
93
    """
65
94
# In URL space, where in the site is IVLE located. (All URLs will be prefixed
66
95
# with this).
67
96
# eg. "/" or "/ivle".""", ask=False))
68
97
 
69
 
config_options.append(ConfigOption("paths/prefix", "/usr/local",
 
98
config_options.append(ConfigOption("prefix", "/usr/local",
70
99
    """In the local file system, the prefix to the system directory where IVLE
71
100
is installed. (This should either be /usr or /usr/local):""",
72
101
    """
75
104
# ('/usr/local' for the usual install, '/usr' for distribution packages)""",
76
105
    ask=False))
77
106
 
78
 
config_options.append(ConfigOption("paths/site_packages",
 
107
config_options.append(ConfigOption("python_site_packages_override",
79
108
    None,
80
109
    """site-packages directory in Python, where Python libraries are to be
81
110
installed. May be left as the default, in which case the value will be
82
111
computed from prefix and the current Python version:""",
83
112
    """
84
113
# 'site-packages' directory in Python, where Python libraries are to be
85
 
# installed. May be omitted (recommended), in which case the value will be
 
114
# installed. May be None (recommended), in which case the value will be
86
115
# computed from prefix and the current Python version.""", ask=False))
87
116
 
88
 
config_options.append(ConfigOption("paths/data",
 
117
config_options.append(ConfigOption("data_path",
89
118
    "/var/lib/ivle",
90
119
    "In the local file system, where user-modifiable data files should be "
91
120
    "located:",
93
122
# In the local file system, where user-modifiable data files should be
94
123
# located.""", ask=False))
95
124
 
96
 
config_options.append(ConfigOption("paths/logs",
 
125
config_options.append(ConfigOption("log_path",
97
126
    "/var/log/ivle",
98
127
    """Directory where IVLE log files are stored (on the local
99
128
file system). Note - this must be writable by the user the IVLE server 
102
131
# In the local file system, where IVLE error logs should be located.""",
103
132
    ask=False))
104
133
 
105
 
config_options.append(ConfigOption("urls/public_host", "public.localhost",
 
134
config_options.append(ConfigOption("public_host", "public.localhost",
106
135
    """Hostname which will cause the server to go into "public mode",
107
136
providing login-free access to student's published work:""",
108
137
    """
113
142
# Private mode (normal mode) requires login, and only serves files relevant to
114
143
# the logged-in user."""))
115
144
 
116
 
config_options.append(ConfigOption("database/host", "localhost",
 
145
config_options.append(ConfigOption("allowed_uids", "33",
 
146
    """UID of the web server process which will run IVLE.
 
147
Only this user may execute the trampoline. May specify multiple users as
 
148
a comma-separated list.
 
149
    (eg. "1002,78")""",
 
150
    """
 
151
# The User-ID of the web server process which will run IVLE, and any other
 
152
# users who are allowed to run the trampoline. This is stores as a string of
 
153
# comma-separated integers, simply because it is not used within Python, only
 
154
# used by the setup program to write to conf.h (see setup.py config).""",
 
155
    ask=False))
 
156
 
 
157
config_options.append(ConfigOption("db_host", "localhost",
117
158
    """PostgreSQL Database config
118
159
==========================
119
160
Hostname of the DB server:""",
120
161
    """
121
162
# Database server hostname"""))
122
163
 
123
 
config_options.append(ConfigOption("database/port", "5432",
 
164
config_options.append(ConfigOption("db_port", "5432",
124
165
    """Port of the DB server:""",
125
166
    """
126
167
# Database server port"""))
127
168
 
128
 
config_options.append(ConfigOption("database/name", "ivle",
 
169
config_options.append(ConfigOption("db_dbname", "ivle",
129
170
    """Database name:""",
130
171
    """
131
172
# Database name"""))
132
173
 
133
 
config_options.append(ConfigOption("database/username", "postgres",
 
174
config_options.append(ConfigOption("db_forumdbname", "ivle_forum",
 
175
    """Forum Database name:""",
 
176
    """
 
177
# Forum Database name"""))
 
178
 
 
179
config_options.append(ConfigOption("db_user", "postgres",
134
180
    """Username for DB server login:""",
135
181
    """
136
182
# Database username"""))
137
183
 
138
 
config_options.append(ConfigOption("database/password", "",
 
184
config_options.append(ConfigOption("db_password", "",
139
185
    """Password for DB server login:
140
 
    (Caution: This password is stored in plaintext!)""",
 
186
    (Caution: This password is stored in plaintext in ivle/conf/conf.py)""",
141
187
    """
142
188
# Database password"""))
143
189
 
144
 
config_options.append(ConfigOption("auth/modules", "",
 
190
config_options.append(ConfigOption("auth_modules", "",
145
191
    """Authentication config
146
192
=====================
147
193
Comma-separated list of authentication modules.""",
155
201
# other modules may be plugged in to auth against organisation-specific
156
202
# auth backends.""", ask=False))
157
203
 
158
 
config_options.append(ConfigOption("auth/ldap_url", "ldaps://www.example.com",
 
204
config_options.append(ConfigOption("ldap_url", "ldaps://www.example.com",
159
205
    """(LDAP options are only relevant if "ldap" is included in the list of
160
206
auth modules).
161
207
URL for LDAP authentication server:""",
162
208
    """
163
209
# URL for LDAP authentication server""", ask=False))
164
210
 
165
 
config_options.append(ConfigOption("auth/ldap_format_string",
 
211
config_options.append(ConfigOption("ldap_format_string",
166
212
    "uid=%s,ou=users,o=example",
167
213
    """Format string for LDAP auth request:
168
214
    (Must contain a single "%s" for the user's login name)""",
170
216
# Format string for LDAP auth request
171
217
# (Must contain a single "%s" for the user's login name)""", ask=False))
172
218
 
173
 
config_options.append(ConfigOption("auth/subject_pulldown_modules", "",
 
219
config_options.append(ConfigOption("subject_pulldown_modules", "",
174
220
    """Comma-separated list of subject pulldown modules.
175
221
Add proprietary modules to automatically enrol students in subjects.""",
176
222
    """
180
226
# other modules may be plugged in to pulldown against organisation-specific
181
227
# pulldown backends.""", ask=False))
182
228
 
183
 
config_options.append(ConfigOption("urls/svn_addr", "http://svn.localhost/",
 
229
config_options.append(ConfigOption("svn_addr", "http://svn.localhost/",
184
230
    """Subversion config
185
231
=================
186
232
The base url for accessing subversion repositories:""",
187
233
    """
188
234
# The base url for accessing subversion repositories."""))
189
235
 
190
 
config_options.append(ConfigOption("usrmgt/host", "localhost",
 
236
config_options.append(ConfigOption("usrmgt_host", "localhost",
191
237
    """User Management Server config
192
238
============================
193
239
The hostname where the usrmgt-server runs:""",
194
240
    """
195
241
# The hostname where the usrmgt-server runs."""))
196
242
 
197
 
config_options.append(ConfigOption("usrmgt/port", "2178",
 
243
config_options.append(ConfigOption("usrmgt_port", "2178",
198
244
    """The port where the usrmgt-server runs:""",
199
245
    """
200
246
# The port where the usrmgt-server runs.""", ask=False))
201
247
 
202
 
config_options.append(ConfigOption("usrmgt/magic", None,
 
248
config_options.append(ConfigOption("usrmgt_magic", None,
203
249
    """The password for the usrmgt-server:""",
204
250
    """
205
251
# The password for the usrmgt-server.""", ask=False))
206
252
 
207
 
def query_user(default, prompt):
208
 
    """Prompts the user for a string, which is read from a line of stdin.
209
 
    Exits silently if EOF is encountered. Returns the string, with spaces
210
 
    removed from the beginning and end.
211
 
 
212
 
    Returns default if a 0-length line (after spaces removed) was read.
213
 
    """
214
 
    if default is None:
215
 
        # A default of None means the value will be computed specially, so we
216
 
        # can't really tell you what it is
217
 
        defaultstr = "computed"
218
 
    elif isinstance(default, basestring):
219
 
        defaultstr = '"%s"' % default
220
 
    else:
221
 
        defaultstr = repr(default)
222
 
    sys.stdout.write('%s\n    (default: %s)\n>' % (prompt, defaultstr))
223
 
    try:
224
 
        val = sys.stdin.readline()
225
 
    except KeyboardInterrupt:
226
 
        # Ctrl+C
227
 
        sys.stdout.write("\n")
228
 
        sys.exit(1)
229
 
    sys.stdout.write("\n")
230
 
    # If EOF, exit
231
 
    if val == '': sys.exit(1)
232
 
    # If empty line, return default
233
 
    val = val.strip()
234
 
    if val == '': return default
235
 
    return val
236
 
 
237
253
def configure(args):
 
254
    # Call the real function
 
255
    return __configure(args)
 
256
 
 
257
def __configure(args):
 
258
    global db_port, usrmgt_port
 
259
 
238
260
    # Try importing existing conf, but if we can't just set up defaults
239
261
    # The reason for this is that these settings are used by other phases
240
262
    # of setup besides conf, so we need to know them.
241
263
    # Also this allows you to hit Return to accept the existing value.
242
264
    try:
243
 
        conf = ivle.config.Config()
244
 
    except ivle.config.ConfigError:
245
 
        # Couldn't find a config file anywhere.
246
 
        # Create a new blank config object (not yet bound to a file)
247
 
        # All lookups (below) will fail, so it will be initialised with all
248
 
        # the default values.
249
 
        conf = ivle.config.Config(blank=True)
250
 
 
251
 
    # Check that all the options are present, and if not, load the default
252
 
    for opt in config_options:
253
 
        try:
254
 
            conf.get_by_path(opt.option_name)
255
 
        except KeyError:
256
 
            # If the default is None, omit it
257
 
            # Else ConfigObj will write the string 'None' to the conf file
258
 
            if opt.default is not None:
259
 
                conf.set_by_path(opt.option_name, opt.default)
260
 
 
261
 
    # Store comments in the conf object
262
 
    for opt in config_options:
263
 
        # Omitted if the key doesn't exist
264
 
        conf.set_by_path(opt.option_name, comment=opt.comment)
 
265
        confmodule = __import__("ivle/conf/conf")
 
266
        for opt in config_options:
 
267
            try:
 
268
                globals()[opt.option_name] = \
 
269
                confmodule.__dict__[opt.option_name]
 
270
            except:
 
271
                globals()[opt.option_name] = opt.default
 
272
    except ImportError:
 
273
        # Just set reasonable defaults
 
274
        for opt in config_options:
 
275
            globals()[opt.option_name] = opt.default
265
276
 
266
277
    # Set up some variables
267
278
    cwd = os.getcwd()
268
279
 
269
280
    # the files that will be created/overwritten
270
 
    try:
271
 
        confdir = os.environ['IVLECONF']
272
 
    except KeyError:
273
 
        confdir = '/etc/ivle'
274
 
 
275
 
    conffile = os.path.join(confdir, 'ivle.conf')
276
 
    plugindefaultfile = os.path.join(confdir, 'plugins.d/000default.conf')
 
281
    conffile = os.path.join(cwd, "etc/ivle.conf")
 
282
    conf_hfile = os.path.join(cwd, "bin/trampoline/conf.h")
 
283
    phpBBconffile = os.path.join(cwd, "www/php/phpBB3/config.php")
277
284
 
278
285
    # Get command-line arguments to avoid asking questions.
279
286
 
289
296
    if opts == []:
290
297
        # Interactive mode. Prompt the user for all the values.
291
298
 
292
 
        print """This tool will create %s, prompting you for details about
293
 
your configuration. The file will be updated with modified options if it already
294
 
exists. If it does not already exist, it will be created with sane defaults and
295
 
restrictive permissions.
296
 
 
297
 
%s will also be overwritten with the default list of plugins.
 
299
        print """This tool will create the following files:
 
300
    %s
 
301
    %s
 
302
    %s
 
303
prompting you for details about your configuration. The file will be
 
304
overwritten if it already exists. It will *not* install or deploy IVLE.
298
305
 
299
306
Please hit Ctrl+C now if you do not wish to do this.
300
 
""" % (conffile, plugindefaultfile)
 
307
""" % (conffile, conf_hfile, phpBBconffile)
301
308
 
302
309
        # Get information from the administrator
303
310
        # If EOF is encountered at any time during the questioning, just exit
305
312
 
306
313
        for opt in config_options:
307
314
            if opt.ask:
308
 
                conf.set_by_path(opt.option_name,
309
 
                    query_user(conf.get_by_path(opt.option_name), opt.prompt))
 
315
                globals()[opt.option_name] = \
 
316
                    query_user(globals()[opt.option_name], opt.prompt)
310
317
    else:
311
318
        opts = dict(opts)
312
319
        # Non-interactive mode. Parse the options.
313
320
        for opt in config_options:
314
321
            if '--' + opt.option_name in opts:
315
 
                conf.set_by_path(opt.option_name,
316
 
                                 opts['--' + opt.option_name])
 
322
                globals()[opt.option_name] = opts['--' + opt.option_name]
317
323
 
318
324
    # Error handling on input values
319
325
    try:
320
 
        conf['database']['port'] = int(conf['database']['port'])
321
 
        if (conf['database']['port'] < 0
322
 
            or conf['database']['port'] >= 65536):
323
 
            raise ValueError()
324
 
    except ValueError:
325
 
        if conf['database']['port'] == '' or conf['database']['port'] is None:
326
 
            pass
327
 
        else:
328
 
            print >>sys.stderr, (
329
 
            "Invalid DB port (%s).\n"
330
 
            "Must be an integer between 0 and 65535." %
331
 
                repr(conf['database']['port']))
332
 
            return 1
333
 
    try:
334
 
        conf['usrmgt']['port'] = int(conf['usrmgt']['port'])
335
 
        if (conf['usrmgt']['port'] < 0 or conf['usrmgt']['port'] >= 65536):
336
 
            raise ValueError()
 
326
        allowed_uids_list = map(int, allowed_uids.split(','))
 
327
    except ValueError:
 
328
        print >>sys.stderr, (
 
329
        "Invalid UID list (%s).\n"
 
330
        "Must be a comma-separated list of integers." % allowed_uids)
 
331
        return 1
 
332
    try:
 
333
        db_port = int(db_port)
 
334
        if db_port < 0 or db_port >= 65536: raise ValueError()
 
335
    except ValueError:
 
336
        print >>sys.stderr, (
 
337
        "Invalid DB port (%s).\n"
 
338
        "Must be an integer between 0 and 65535." % repr(db_port))
 
339
        return 1
 
340
    try:
 
341
        usrmgt_port = int(usrmgt_port)
 
342
        if usrmgt_port < 0 or usrmgt_port >= 65536: raise ValueError()
337
343
    except ValueError:
338
344
        print >>sys.stderr, (
339
345
        "Invalid user management port (%s).\n"
340
 
        "Must be an integer between 0 and 65535." %
341
 
            repr(conf['usrmgt']['port']))
 
346
        "Must be an integer between 0 and 65535." % repr(usrmgt_port))
342
347
        return 1
343
348
 
344
349
    # By default we generate the magic randomly.
345
 
    try:
346
 
        conf['usrmgt']['magic']     # Throw away; just check for KeyError
347
 
    except KeyError:
348
 
        conf['usrmgt']['magic'] = hashlib.md5(uuid.uuid4().bytes).hexdigest()
349
 
 
350
 
    clobber_permissions = not os.path.exists(conffile)
351
 
 
352
 
    # Write ./etc/ivle.conf (even if we loaded from a different filename)
 
350
    if globals()['usrmgt_magic'] is None:
 
351
        globals()['usrmgt_magic'] = hashlib.md5(uuid.uuid4().bytes).hexdigest()
 
352
 
 
353
    # Generate the forum secret
 
354
    forum_secret = hashlib.md5(uuid.uuid4().bytes).hexdigest()
 
355
 
 
356
    # Write ./etc/ivle.conf
 
357
 
 
358
    conf = configobj.ConfigObj()
353
359
    conf.filename = conffile
 
360
 
354
361
    conf.initial_comment = ["# IVLE Configuration File"]
 
362
 
 
363
    # Add the forum secret to the config file (regenerated each config)
 
364
    config_options.append(ConfigOption('forum_secret', None, '', ''))
 
365
    globals()['forum_secret'] = forum_secret
 
366
 
 
367
    for legacyopt in config_options:
 
368
        newopt_path = CONFIG_OPTIONS[legacyopt.option_name].split('/')
 
369
        # Iterate over each segment of the path, and find the section in conf
 
370
        # file to insert the value into (use all but the last path segment)
 
371
        conf_section = conf
 
372
        for seg in newopt_path[:-1]:
 
373
            # Create the section if it isn't there
 
374
            if seg not in conf_section:
 
375
                conf_section[seg] = {}
 
376
            conf_section = conf_section[seg]
 
377
        # The final path segment names the key to insert into
 
378
        keyname = newopt_path[-1]
 
379
        value = globals()[legacyopt.option_name]
 
380
        if value is not None:
 
381
            conf_section[keyname] = value
 
382
            conf_section.comments[keyname] = legacyopt.comment.split('\n')
 
383
 
355
384
    conf.write()
356
385
 
357
 
    # We need to restrict permissions on a new file, as it contains
358
 
    # a nice database password.
359
 
    if clobber_permissions:
360
 
        os.chown(conffile, 33, 33) # chown to www-data
361
 
        os.chmod(conffile, stat.S_IRUSR | stat.S_IWUSR) # No g/o perms!
362
 
 
363
386
    print "Successfully wrote %s" % conffile
364
387
 
365
 
    plugindefault = open(plugindefaultfile, 'w')
366
 
    plugindefault.write("""# IVLE default plugin configuration file
367
 
[ivle.webapp.core#Plugin]
368
 
[ivle.webapp.admin.user#Plugin]
369
 
[ivle.webapp.tutorial#Plugin]
370
 
[ivle.webapp.admin.subject#Plugin]
371
 
[ivle.webapp.filesystem.browser#Plugin]
372
 
[ivle.webapp.filesystem.diff#Plugin]
373
 
[ivle.webapp.filesystem.svnlog#Plugin]
374
 
[ivle.webapp.filesystem.serve#Plugin]
375
 
[ivle.webapp.groups#Plugin]
376
 
[ivle.webapp.console#Plugin]
377
 
[ivle.webapp.security#Plugin]
378
 
[ivle.webapp.media#Plugin]
379
 
[ivle.webapp.help#Plugin]
380
 
[ivle.webapp.tos#Plugin]
381
 
[ivle.webapp.userservice#Plugin]
382
 
[ivle.webapp.fileservice#Plugin]
383
 
""")
384
 
    plugindefault.close()
385
 
    print "Successfully wrote %s" % plugindefaultfile
386
 
 
387
 
    print
388
 
    print "You may modify the configuration at any time by editing " + conffile
 
388
    # Write bin/trampoline/conf.h
 
389
 
 
390
    conf = open(conf_hfile, "w")
 
391
 
 
392
    # XXX Compute jail_base, jail_src_base and jail_system. These will
 
393
    # ALSO be done by the boilerplate code, but we need them here in order
 
394
    # to write to the C file.
 
395
    jail_base = os.path.join(data_path, 'jailmounts')
 
396
    jail_src_base = os.path.join(data_path, 'jails')
 
397
    jail_system = os.path.join(jail_src_base, '__base__')
 
398
 
 
399
    conf.write("""/* IVLE Configuration File
 
400
 * conf.h
 
401
 * Administrator settings required by trampoline.
 
402
 * Note: trampoline will have to be rebuilt in order for changes to this file
 
403
 * to take effect.
 
404
 */
 
405
 
 
406
#define IVLE_AUFS_JAILS
 
407
 
 
408
/* In the local file system, where are the jails located.
 
409
 * The trampoline does not allow the creation of a jail anywhere besides
 
410
 * jail_base or a subdirectory of jail_base.
 
411
 */
 
412
static const char* jail_base = "%s";
 
413
static const char* jail_src_base = "%s";
 
414
static const char* jail_system = "%s";
 
415
 
 
416
/* Which user IDs are allowed to run the trampoline.
 
417
 * This list should be limited to the web server user.
 
418
 * (Note that root is an implicit member of this list).
 
419
 */
 
420
static const int allowed_uids[] = { %s };
 
421
""" % (repr(jail_base)[1:-1], repr(jail_src_base)[1:-1],
 
422
       repr(jail_system)[1:-1], repr(allowed_uids_list)[1:-1]))
 
423
    # Note: The above uses PYTHON reprs, not C reprs
 
424
    # However they should be the same with the exception of the outer
 
425
    # characters, which are stripped off and replaced
 
426
 
 
427
    conf.close()
 
428
 
 
429
    print "Successfully wrote %s" % conf_hfile
 
430
 
 
431
    # Write www/php/phpBB3/config.php
 
432
 
 
433
    conf = open(phpBBconffile, "w")
 
434
    
 
435
    # php-pg work around
 
436
    if db_host == 'localhost':
 
437
        forumdb_host = '127.0.0.1'
 
438
    else:
 
439
        forumdb_host = db_host
 
440
 
 
441
    conf.write( """<?php
 
442
// phpBB 3.0.x auto-generated configuration file
 
443
// Do not change anything in this file!
 
444
$dbms = 'postgres';
 
445
$dbhost = '""" + forumdb_host + """';
 
446
$dbport = '""" + str(db_port) + """';
 
447
$dbname = '""" + db_forumdbname + """';
 
448
$dbuser = '""" + db_user + """';
 
449
$dbpasswd = '""" + db_password + """';
 
450
 
 
451
$table_prefix = 'phpbb_';
 
452
$acm_type = 'file';
 
453
$load_extensions = '';
 
454
@define('PHPBB_INSTALLED', true);
 
455
// @define('DEBUG', true);
 
456
//@define('DEBUG_EXTRA', true);
 
457
 
 
458
$forum_secret = '""" + forum_secret +"""';
 
459
?>"""   )
 
460
    
 
461
    conf.close()
 
462
 
 
463
    print "Successfully wrote %s" % phpBBconffile
 
464
 
 
465
    print
 
466
    print "You may modify the configuration at any time by editing"
 
467
    print conffile
 
468
    print conf_hfile
 
469
    print phpBBconffile
 
470
    print
389
471
    
390
472
    return 0
391
 
 
392
 
def main(argv=None):
393
 
    if argv is None:
394
 
        argv = sys.argv
395
 
 
396
 
    # Print the opening spiel including the GPL notice
397
 
 
398
 
    print """IVLE - Informatics Virtual Learning Environment Setup
399
 
Copyright (C) 2007-2009 The University of Melbourne
400
 
IVLE comes with ABSOLUTELY NO WARRANTY.
401
 
This is free software, and you are welcome to redistribute it
402
 
under certain conditions. See LICENSE.txt for details.
403
 
 
404
 
IVLE Configuration
405
 
"""
406
 
 
407
 
    return configure(argv[1:])
408
 
 
409
 
if __name__ == "__main__":
410
 
    sys.exit(main())