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",
270
281
(Caution: This password is stored in plaintext in lib/conf/conf.py)""",
272
283
# Database password"""))
284
config_options.append(ConfigOption("auth_modules", "ldap_auth",
285
"""Authentication config
286
=====================
287
Comma-separated list of authentication modules. Only "ldap" is available
290
# Comma-separated list of authentication modules.
291
# These refer to importable Python modules in the www/auth directory.
292
# Modules "ldap" and "guest" are available in the source tree, but
293
# other modules may be plugged in to auth against organisation-specific
294
# auth backends."""))
295
config_options.append(ConfigOption("ldap_url", "ldaps://www.example.com",
296
"""(LDAP options are only relevant if "ldap" is included in the list of
298
URL for LDAP authentication server:""",
300
# URL for LDAP authentication server"""))
301
config_options.append(ConfigOption("ldap_format_string",
302
"uid=%s,ou=users,o=example",
303
"""Format string for LDAP auth request:
304
(Must contain a single "%s" for the user's login name)""",
306
# Format string for LDAP auth request
307
# (Must contain a single "%s" for the user's login name)"""))
308
config_options.append(ConfigOption("svn_addr", "http://svn.localhost/",
311
The base url for accessing subversion repositories:""",
313
# The base url for accessing subversion repositories."""))
273
314
config_options.append(ConfigOption("svn_conf", "/opt/ivle/svn/svn.conf",
274
315
"""The location of the subversion configuration file used by apache
275
316
to host the user repositories:""",
293
334
# The location of the password file used to authenticate local users
294
335
# of the subversion repository."""))
295
336
config_options.append(ConfigOption("usrmgt_host", "localhost",
296
"""The hostname where the usrmgt-server runs:""",
337
"""User Management Server config
338
============================
339
The hostname where the usrmgt-server runs:""",
298
341
# The hostname where the usrmgt-server runs."""))
299
342
config_options.append(ConfigOption("usrmgt_port", "2178",
458
501
Copy subjects/ to subjects directory (unless --nosubjects specified).
460
503
--nojail Do not copy the jail.
461
--nosubjects Do not copy the subjects and problems directories.
504
--nosubjects Do not copy the subjects and exercises directories.
462
505
--dry | -n Print out the actions but don't do anything."""
463
506
elif operation == 'updatejails':
464
507
print """sudo python setup.py updatejails [--dry|-n]
477
520
list_www = build_list_py_files('www')
478
521
list_lib = build_list_py_files('lib')
479
522
list_subjects = build_list_py_files('subjects', no_top_level=True)
480
list_problems = build_list_py_files('problems', no_top_level=True)
523
list_exercises = build_list_py_files('exercises', no_top_level=True)
482
525
"scripts/python-console",
483
526
"scripts/fileservice",
519
562
list_subjects = """)
520
563
writelist_pretty(file, list_subjects)
522
# List of all installable files in problems directory.
565
# List of all installable files in exercises directory.
523
566
# This is to install sample exercise material.
525
writelist_pretty(file, list_problems)
567
list_exercises = """)
568
writelist_pretty(file, list_exercises)
528
571
except IOError, (errno, strerror):
762
805
action_mkdir('jail/home', dry)
763
806
action_mkdir('jail/tmp', dry)
808
# Chmod the tmp directory to world writable
809
action_chmod_w('jail/tmp', dry)
765
811
# Copy all console and operating system files into the jail
766
812
action_copylist(install_list.list_scripts, 'jail/opt/ivle', dry)
767
813
copy_os_files_jail(dry)
840
886
# chown trampoline to root and set setuid bit
841
887
action_chown_setuid(tramppath, dry)
889
# Create a scripts directory to put the usrmgt-server in.
890
action_mkdir(os.path.join(ivle_install_dir, 'scripts'), dry)
891
usrmgtpath = os.path.join(ivle_install_dir, 'scripts/usrmgt-server')
892
action_copyfile('scripts/usrmgt-server', usrmgtpath, dry)
893
action_chmod_x(usrmgtpath, dry)
843
895
# Copy the www and lib directories using the list
844
896
action_copylist(install_list.list_www, ivle_install_dir, dry)
845
897
action_copylist(install_list.list_lib, ivle_install_dir, dry)
899
# Copy the php directory
900
action_copytree('www/php/phpBB3',os.path.join(ivle_install_dir,'www/php/phpBB3'),
848
904
# Copy the local jail directory built by the build action
850
906
# for all the students' jails).
851
907
action_copytree('jail', os.path.join(jail_base, 'template'), dry)
852
908
if not nosubjects:
853
# Copy the subjects and problems directories across
909
# Copy the subjects and exercises directories across
854
910
action_copylist(install_list.list_subjects, subjects_base, dry,
855
911
srcdir="./subjects")
856
action_copylist(install_list.list_problems, problems_base, dry,
912
action_copylist(install_list.list_exercises, exercises_base, dry,
913
srcdir="./exercises")
859
915
# Append IVLE path to ivle.pth in python site packages
860
916
# (Unless it's already there)
984
1040
directories as necessary.
986
1042
See shutil.copytree."""
1043
# Allow copying over itself
1044
if (os.path.normpath(os.path.join(os.getcwd(),src)) ==
1045
os.path.normpath(os.path.join(os.getcwd(),dst))):
987
1047
action_remove(dst, dry)
988
1048
print "cp -r", src, dst
1074
1134
os.chmod(file, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR
1075
1135
| stat.S_IXGRP | stat.S_IRGRP | stat.S_IXOTH | stat.S_IROTH)
1138
def action_chmod_w(file, dry):
1139
"""Chmod 777 a file (sets permissions to rwxrwxrwx)."""
1140
print "chmod 777", file
1142
os.chmod(file, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR
1143
| stat.S_IXGRP | stat.S_IWGRP | stat.S_IRGRP | stat.S_IXOTH
1144
| stat.S_IWOTH | stat.S_IROTH)
1077
1146
def query_user(default, prompt):
1078
1147
"""Prompts the user for a string, which is read from a line of stdin.
1079
1148
Exits silently if EOF is encountered. Returns the string, with spaces