323
325
# Generate the forum secret
324
326
forum_secret = hashlib.md5(uuid.uuid4().bytes).hexdigest()
326
# Write lib/conf/conf.py
328
conf = open(conffile, "w")
330
conf.write("""# IVLE Configuration File
332
# Miscellaneous application settings
328
# Write ./etc/ivle.conf
330
conf = configobj.ConfigObj()
331
conf.filename = conffile
333
conf.initial_comment = ["# IVLE Configuration File"]
337
335
for opt in config_options:
338
conf.write('%s\n%s = %r\n' % (opt.comment, opt.option_name,
339
globals()[opt.option_name]))
336
conf[opt.option_name] = globals()[opt.option_name]
337
conf.comments[opt.option_name] = opt.comment.split('\n')
341
339
# Add the forum secret to the config file (regenerated each config)
342
conf.write('forum_secret = "%s"\n\n' % (forum_secret))
344
write_conf_file_boilerplate(conf)
340
conf['forum_secret'] = forum_secret
348
344
print "Successfully wrote %s" % conffile
436
def write_conf_file_boilerplate(conf_file):
438
### Below is boilerplate code, appended by ./setup.py config ###
440
# Path where architecture-dependent data (including non-user-executable
441
# binaries) is installed.
442
lib_path = os.path.join(prefix, 'lib/ivle')
444
# Path where arch-independent data is installed.
445
share_path = os.path.join(prefix, 'share/ivle')
447
# Path where user-executable binaries are installed.
448
bin_path = os.path.join(prefix, 'bin')
450
# 'site-packages' directory in Python, where Python libraries are to be
452
if python_site_packages_override is None:
453
PYTHON_VERSION = sys.version[0:3] # eg. "2.5"
454
python_site_packages = os.path.join(prefix,
455
'lib/python%s/site-packages' % PYTHON_VERSION)
457
python_site_packages = python_site_packages_override
459
# In the local file system, where the student/user jails will be mounted.
460
# Only a single copy of the jail's system components will be stored here -
461
# all user jails will be virtually mounted here.
462
jail_base = os.path.join(data_path, 'jailmounts')
464
# In the local file system, where are the student/user file spaces located.
465
# The user jails are expected to be located immediately in subdirectories of
466
# this location. Note that no complete jails reside here - only user
468
jail_src_base = os.path.join(data_path, 'jails')
470
# In the local file system, where the template system jail will be stored.
471
jail_system = os.path.join(jail_src_base, '__base__')
473
# In the local file system, where the template system jail will be stored.
474
jail_system_build = os.path.join(jail_src_base, '__base_build__')
476
# In the local file system, where the subject content files are located.
477
# (The 'subjects' and 'exercises' directories).
478
content_path = os.path.join(data_path, 'content')
480
# In the local file system, where are the per-subject file spaces located.
481
# The individual subject directories are expected to be located immediately
482
# in subdirectories of this location.
483
subjects_base = os.path.join(content_path, 'subjects')
485
# In the local file system, where are the subject-independent exercise sheet
486
# file spaces located.
487
exercises_base = os.path.join(content_path, 'exercises')
489
# In the local file system, where the system notices are stored (such as terms
490
# of service and MOTD).
491
notices_path = os.path.join(data_path, 'notices')
493
# In the local file system, where is the Terms of Service document located.
494
tos_path = os.path.join(notices_path, 'tos.html')
496
# In the local file system, where is the Message of the Day document
497
# located. This is an HTML file (just the body fragment), which will
498
# be displayed on the login page. It is optional.
499
motd_path = os.path.join(notices_path, 'motd.html')
501
# The location of all the subversion config and repositories.
502
svn_path = os.path.join(data_path, 'svn')
504
# The location of the subversion configuration file used by
505
# apache to host the user repositories.
506
svn_conf = os.path.join(svn_path, 'svn.conf')
508
# The location of the subversion configuration file used by
509
# apache to host the user repositories.
510
svn_group_conf = os.path.join(svn_path, 'svn-group.conf')
512
# The root directory for the subversion repositories.
513
svn_repo_path = os.path.join(svn_path, 'repositories')
515
# The location of the password file used to authenticate users
516
# of the subversion repository from the ivle server.
517
svn_auth_ivle = os.path.join(svn_path, 'ivle.auth')