204
213
# In the local file system, where IVLE is actually installed.
205
214
# This directory should contain the "www" and "bin" directories."""))
206
215
config_options.append(ConfigOption("jail_base", "/home/informatics/jails",
207
"""Root directory where the jails (containing user files) are stored
216
"""Location of Directories
217
=======================
218
Root directory where the jails (containing user files) are stored
208
219
(on the local file system):""",
210
221
# In the local file system, where are the student/user file spaces located.
218
229
# In the local file system, where are the per-subject file spaces located.
219
230
# The individual subject directories are expected to be located immediately
220
231
# in subdirectories of this location."""))
221
config_options.append(ConfigOption("problems_base",
222
"/home/informatics/problems",
223
"""Root directory where the problem directories (containing
224
subject-independent problem sheets) are stored (on the local file
232
config_options.append(ConfigOption("exercises_base",
233
"/home/informatics/exercises",
234
"""Root directory where the exercise directories (containing
235
subject-independent exercise sheets) are stored (on the local file
227
# In the local file system, where are the subject-independent problem sheet
238
# In the local file system, where are the subject-independent exercise sheet
228
239
# file spaces located."""))
229
240
config_options.append(ConfigOption("public_host", "public.localhost",
230
241
"""Hostname which will cause the server to go into "public mode",
261
272
"""Database name:""",
263
274
# Database name"""))
275
config_options.append(ConfigOption("db_forumdbname", "ivle_forum",
276
"""Forum Database name:""",
278
# Forum Database name"""))
264
279
config_options.append(ConfigOption("db_user", "postgres",
265
280
"""Username for DB server login:""",
270
285
(Caution: This password is stored in plaintext in lib/conf/conf.py)""",
272
287
# Database password"""))
288
config_options.append(ConfigOption("auth_modules", "ldap_auth",
289
"""Authentication config
290
=====================
291
Comma-separated list of authentication modules. Only "ldap" is available
294
# Comma-separated list of authentication modules.
295
# These refer to importable Python modules in the www/auth directory.
296
# Modules "ldap" and "guest" are available in the source tree, but
297
# other modules may be plugged in to auth against organisation-specific
298
# auth backends."""))
299
config_options.append(ConfigOption("ldap_url", "ldaps://www.example.com",
300
"""(LDAP options are only relevant if "ldap" is included in the list of
302
URL for LDAP authentication server:""",
304
# URL for LDAP authentication server"""))
305
config_options.append(ConfigOption("ldap_format_string",
306
"uid=%s,ou=users,o=example",
307
"""Format string for LDAP auth request:
308
(Must contain a single "%s" for the user's login name)""",
310
# Format string for LDAP auth request
311
# (Must contain a single "%s" for the user's login name)"""))
312
config_options.append(ConfigOption("svn_addr", "http://svn.localhost/",
315
The base url for accessing subversion repositories:""",
317
# The base url for accessing subversion repositories."""))
273
318
config_options.append(ConfigOption("svn_conf", "/opt/ivle/svn/svn.conf",
274
319
"""The location of the subversion configuration file used by apache
275
320
to host the user repositories:""",
293
338
# The location of the password file used to authenticate local users
294
339
# of the subversion repository."""))
295
340
config_options.append(ConfigOption("usrmgt_host", "localhost",
296
"""The hostname where the usrmgt-server runs:""",
341
"""User Management Server config
342
============================
343
The hostname where the usrmgt-server runs:""",
298
345
# The hostname where the usrmgt-server runs."""))
299
346
config_options.append(ConfigOption("usrmgt_port", "2178",
334
381
# as necessary, and include it in the distribution.
335
382
listmake_mimetypes = ['text/x-python', 'text/html',
336
383
'application/x-javascript', 'application/javascript',
337
'text/css', 'image/png', 'application/xml']
384
'text/css', 'image/png', 'image/gif', 'application/xml']
339
386
# Main function skeleton from Guido van Rossum
340
387
# http://www.artima.com/weblogs/viewpost.jsp?thread=4829
458
505
Copy subjects/ to subjects directory (unless --nosubjects specified).
460
507
--nojail Do not copy the jail.
461
--nosubjects Do not copy the subjects and problems directories.
508
--nosubjects Do not copy the subjects and exercises directories.
462
509
--dry | -n Print out the actions but don't do anything."""
463
510
elif operation == 'updatejails':
464
511
print """sudo python setup.py updatejails [--dry|-n]
477
524
list_www = build_list_py_files('www')
478
525
list_lib = build_list_py_files('lib')
479
526
list_subjects = build_list_py_files('subjects', no_top_level=True)
480
list_problems = build_list_py_files('problems', no_top_level=True)
527
list_exercises = build_list_py_files('exercises', no_top_level=True)
482
529
"scripts/python-console",
483
530
"scripts/fileservice",
484
531
"scripts/usrmgt-server",
532
"scripts/diffservice",
486
534
# Make sure that the files generated by conf are in the list
487
535
# (since listmake is typically run before conf)
519
567
list_subjects = """)
520
568
writelist_pretty(file, list_subjects)
522
# List of all installable files in problems directory.
570
# List of all installable files in exercises directory.
523
571
# This is to install sample exercise material.
525
writelist_pretty(file, list_problems)
572
list_exercises = """)
573
writelist_pretty(file, list_exercises)
528
576
except IOError, (errno, strerror):
576
624
conffile = os.path.join(cwd, "lib/conf/conf.py")
577
625
jailconffile = os.path.join(cwd, "lib/conf/jailconf.py")
578
626
conf_hfile = os.path.join(cwd, "trampoline/conf.h")
627
phpBBconffile = os.path.join(cwd, "www/php/phpBB3/config.php")
580
629
# Get command-line arguments to avoid asking questions.
734
783
print "Successfully wrote trampoline/conf.h"
785
# Write www/php/phpBB3/config.php
788
conf = open(phpBBconffile, "w")
791
if db_host == 'localhost':
792
forumdb_host = '127.0.0.1'
794
forumdb_host = db_host
797
// phpBB 3.0.x auto-generated configuration file
798
// Do not change anything in this file!
800
$dbhost = '""" + forumdb_host + """';
801
$dbport = '""" + str(db_port) + """';
802
$dbname = '""" + db_forumdbname + """';
803
$dbuser = '""" + db_user + """';
804
$dbpasswd = '""" + db_password + """';
806
$table_prefix = 'phpbb_';
808
$load_extensions = '';
809
@define('PHPBB_INSTALLED', true);
810
// @define('DEBUG', true);
811
//@define('DEBUG_EXTRA', true);
815
except IOError, (errno, strerror):
816
print "IO error(%s): %s" % (errno, strerror)
819
print "Successfully wrote www/php/phpBB3/config.php"
737
822
print "You may modify the configuration at any time by editing"
739
824
print jailconffile
762
848
action_mkdir('jail/home', dry)
763
849
action_mkdir('jail/tmp', dry)
851
# Chmod the tmp directory to world writable
852
action_chmod_w('jail/tmp', dry)
765
854
# Copy all console and operating system files into the jail
766
855
action_copylist(install_list.list_scripts, 'jail/opt/ivle', dry)
767
856
copy_os_files_jail(dry)
840
929
# chown trampoline to root and set setuid bit
841
930
action_chown_setuid(tramppath, dry)
932
# Create a scripts directory to put the usrmgt-server in.
933
action_mkdir(os.path.join(ivle_install_dir, 'scripts'), dry)
934
usrmgtpath = os.path.join(ivle_install_dir, 'scripts/usrmgt-server')
935
action_copyfile('scripts/usrmgt-server', usrmgtpath, dry)
936
action_chmod_x(usrmgtpath, dry)
843
938
# Copy the www and lib directories using the list
844
939
action_copylist(install_list.list_www, ivle_install_dir, dry)
845
940
action_copylist(install_list.list_lib, ivle_install_dir, dry)
942
# Copy the php directory
943
action_copytree('www/php/phpBB3',os.path.join(ivle_install_dir,'www/php/phpBB3'),
848
947
# Copy the local jail directory built by the build action
850
949
# for all the students' jails).
851
950
action_copytree('jail', os.path.join(jail_base, 'template'), dry)
852
951
if not nosubjects:
853
# Copy the subjects and problems directories across
952
# Copy the subjects and exercises directories across
854
953
action_copylist(install_list.list_subjects, subjects_base, dry,
855
954
srcdir="./subjects")
856
action_copylist(install_list.list_problems, problems_base, dry,
955
action_copylist(install_list.list_exercises, exercises_base, dry,
956
srcdir="./exercises")
859
958
# Append IVLE path to ivle.pth in python site packages
860
959
# (Unless it's already there)
984
1083
directories as necessary.
986
1085
See shutil.copytree."""
1086
# Allow copying over itself
1087
if (os.path.normpath(os.path.join(os.getcwd(),src)) ==
1088
os.path.normpath(os.path.join(os.getcwd(),dst))):
987
1090
action_remove(dst, dry)
988
1091
print "cp -r", src, dst
1074
1177
os.chmod(file, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR
1075
1178
| stat.S_IXGRP | stat.S_IRGRP | stat.S_IXOTH | stat.S_IROTH)
1181
def action_chmod_w(file, dry):
1182
"""Chmod 777 a file (sets permissions to rwxrwxrwx)."""
1183
print "chmod 777", file
1185
os.chmod(file, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR
1186
| stat.S_IXGRP | stat.S_IWGRP | stat.S_IRGRP | stat.S_IXOTH
1187
| stat.S_IWOTH | stat.S_IROTH)
1077
1189
def query_user(default, prompt):
1078
1190
"""Prompts the user for a string, which is read from a line of stdin.
1079
1191
Exits silently if EOF is encountered. Returns the string, with spaces