218
244
# In the local file system, where are the per-subject file spaces located.
219
245
# The individual subject directories are expected to be located immediately
220
246
# 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
247
config_options.append(ConfigOption("exercises_base",
248
"/home/informatics/exercises",
249
"""Root directory where the exercise directories (containing
250
subject-independent exercise sheets) are stored (on the local file
227
# In the local file system, where are the subject-independent problem sheet
253
# In the local file system, where are the subject-independent exercise sheet
228
254
# file spaces located."""))
255
config_options.append(ConfigOption("tos_path",
256
"/home/informatics/tos.html",
257
"""Location where the Terms of Service document is stored (on the local
260
# In the local file system, where is the Terms of Service document located."""))
261
config_options.append(ConfigOption("motd_path",
262
"/home/informatics/motd.html",
263
"""Location where the Message of the Day document is stored (on the local
266
# In the local file system, where is the Message of the Day document
267
# located. This is an HTML file (just the body fragment), which will
268
# be displayed on the login page. It is optional."""))
229
269
config_options.append(ConfigOption("public_host", "public.localhost",
230
270
"""Hostname which will cause the server to go into "public mode",
231
271
providing login-free access to student's published work:""",
270
314
(Caution: This password is stored in plaintext in lib/conf/conf.py)""",
272
316
# Database password"""))
317
config_options.append(ConfigOption("auth_modules", "ldap_auth",
318
"""Authentication config
319
=====================
320
Comma-separated list of authentication modules. Only "ldap" is available
323
# Comma-separated list of authentication modules.
324
# These refer to importable Python modules in the www/auth directory.
325
# Modules "ldap" and "guest" are available in the source tree, but
326
# other modules may be plugged in to auth against organisation-specific
327
# auth backends."""))
328
config_options.append(ConfigOption("ldap_url", "ldaps://www.example.com",
329
"""(LDAP options are only relevant if "ldap" is included in the list of
331
URL for LDAP authentication server:""",
333
# URL for LDAP authentication server"""))
334
config_options.append(ConfigOption("ldap_format_string",
335
"uid=%s,ou=users,o=example",
336
"""Format string for LDAP auth request:
337
(Must contain a single "%s" for the user's login name)""",
339
# Format string for LDAP auth request
340
# (Must contain a single "%s" for the user's login name)"""))
341
config_options.append(ConfigOption("svn_addr", "http://svn.localhost/",
344
The base url for accessing subversion repositories:""",
346
# The base url for accessing subversion repositories."""))
347
config_options.append(ConfigOption("svn_conf", "/opt/ivle/svn/svn.conf",
348
"""The location of the subversion configuration file used by apache
349
to host the user repositories:""",
351
# The location of the subversion configuration file used by
352
# apache to host the user repositories."""))
353
config_options.append(ConfigOption("svn_repo_path", "/home/informatics/repositories",
354
"""The root directory for the subversion repositories:""",
356
# The root directory for the subversion repositories."""))
357
config_options.append(ConfigOption("svn_auth_ivle", "/opt/ivle/svn/ivle.auth",
358
"""The location of the password file used to authenticate users
359
of the subversion repository from the ivle server:""",
361
# The location of the password file used to authenticate users
362
# of the subversion repository from the ivle server."""))
363
config_options.append(ConfigOption("svn_auth_local", "/opt/ivle/svn/local.auth",
364
"""The location of the password file used to authenticate local users
365
of the subversion repository:""",
367
# The location of the password file used to authenticate local users
368
# of the subversion repository."""))
369
config_options.append(ConfigOption("usrmgt_host", "localhost",
370
"""User Management Server config
371
============================
372
The hostname where the usrmgt-server runs:""",
374
# The hostname where the usrmgt-server runs."""))
375
config_options.append(ConfigOption("usrmgt_port", "2178",
376
"""The port where the usrmgt-server runs:""",
378
# The port where the usrmgt-server runs."""))
379
config_options.append(ConfigOption("usrmgt_magic", "",
380
"""The password for the usrmgt-server:""",
382
# The password for the usrmgt-server."""))
274
384
# Try importing existing conf, but if we can't just set up defaults
275
385
# The reason for this is that these settings are used by other phases
442
552
# We build two separate lists, by walking www and console
443
553
list_www = build_list_py_files('www')
444
554
list_lib = build_list_py_files('lib')
445
list_scripts = build_list_py_files('scripts')
446
555
list_subjects = build_list_py_files('subjects', no_top_level=True)
447
list_problems = build_list_py_files('problems', no_top_level=True)
556
list_exercises = build_list_py_files('exercises', no_top_level=True)
558
"scripts/python-console",
559
"scripts/fileservice",
560
"scripts/serveservice",
561
"scripts/usrmgt-server",
562
"scripts/diffservice",
448
564
# Make sure that the files generated by conf are in the list
449
565
# (since listmake is typically run before conf)
450
566
if "lib/conf/conf.py" not in list_lib:
451
567
list_lib.append("lib/conf/conf.py")
452
# Make sure that console/python-console is in the list
453
if "scripts/python-console" not in list_scripts:
454
list_scripts.append("scripts/python-console")
455
if "scripts/fileservice" not in list_scripts:
456
list_scripts.append("scripts/fileservice")
457
568
# Write these out to a file
458
569
cwd = os.getcwd()
459
570
# the files that will be created/overwritten
693
822
print "Successfully wrote trampoline/conf.h"
824
# Write www/php/phpBB3/config.php
827
conf = open(phpBBconffile, "w")
830
if db_host == 'localhost':
831
forumdb_host = '127.0.0.1'
833
forumdb_host = db_host
836
// phpBB 3.0.x auto-generated configuration file
837
// Do not change anything in this file!
839
$dbhost = '""" + forumdb_host + """';
840
$dbport = '""" + str(db_port) + """';
841
$dbname = '""" + db_forumdbname + """';
842
$dbuser = '""" + db_user + """';
843
$dbpasswd = '""" + db_password + """';
845
$table_prefix = 'phpbb_';
847
$load_extensions = '';
848
@define('PHPBB_INSTALLED', true);
849
// @define('DEBUG', true);
850
//@define('DEBUG_EXTRA', true);
852
$forum_secret = '""" + forum_secret +"""';
856
except IOError, (errno, strerror):
857
print "IO error(%s): %s" % (errno, strerror)
860
print "Successfully wrote www/php/phpBB3/config.php"
862
# Write lib/conf/usrmgt-server.init
865
conf = open(usrmgtserver_initdfile, "w")
867
conf.write( '''#! /bin/sh
869
# Works for Ubuntu. Check before using on other distributions
872
# Provides: usrmgt-server
873
# Required-Start: $syslog $networking $urandom
874
# Required-Stop: $syslog
875
# Default-Start: 2 3 4 5
877
# Short-Description: IVLE user management server
878
# Description: Daemon connecting to the IVLE user management database.
881
PATH=/sbin:/bin:/usr/sbin:/usr/bin
882
DESC="IVLE user management server"
884
DAEMON=/opt/ivle/scripts/$NAME
885
DAEMON_ARGS="''' + str(usrmgt_port) + ''' ''' + usrmgt_magic + '''"
886
PIDFILE=/var/run/$NAME.pid
887
SCRIPTNAME=/etc/init.d/usrmgt-server
889
# Exit if the daemon does not exist
890
test -f $DAEMON || exit 0
892
# Load the VERBOSE setting and other rcS variables
893
[ -f /etc/default/rcS ] && . /etc/default/rcS
895
# Define LSB log_* functions.
896
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
897
. /lib/lsb/init-functions
900
# Function that starts the daemon/service
905
# 0 if daemon has been started
906
# 1 if daemon was already running
907
# 2 if daemon could not be started
908
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
910
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
913
# Add code here, if necessary, that waits for the process to be ready
914
# to handle requests from services started subsequently which depend
915
# on this one. As a last resort, sleep for some time.
919
# Function that stops the daemon/service
924
# 0 if daemon has been stopped
925
# 1 if daemon was already stopped
926
# 2 if daemon could not be stopped
927
# other if a failure occurred
928
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
930
[ "$RETVAL" = 2 ] && return 2
931
# Wait for children to finish too if this is a daemon that forks
932
# and if the daemon is only ever run from this initscript.
933
# If the above conditions are not satisfied then add some other code
934
# that waits for the process to drop all resources that could be
935
# needed by services started subsequently. A last resort is to
936
# sleep for some time.
937
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
938
[ "$?" = 2 ] && return 2
939
# Many daemons don't delete their pidfiles when they exit.
945
# Function that sends a SIGHUP to the daemon/service
949
# If the daemon can reload its configuration without
950
# restarting (for example, when it is sent a SIGHUP),
951
# then implement that here.
953
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
959
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
962
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
963
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
967
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
970
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
971
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
974
#reload|force-reload)
976
# If do_reload() is not implemented then leave this commented out
977
# and leave 'force-reload' as an alias for 'restart'.
979
#log_daemon_msg "Reloading $DESC" "$NAME"
983
restart|force-reload)
985
# If the "reload" option is implemented then remove the
986
# 'force-reload' alias
988
log_daemon_msg "Restarting $DESC" "$NAME"
995
1) log_end_msg 1 ;; # Old process is still running
996
*) log_end_msg 1 ;; # Failed to start
1006
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
1007
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
1016
except IOError, (errno, strerror):
1017
print "IO error(%s): %s" % (errno, strerror)
1020
# fix permissions as the file contains the database password
1022
os.chmod('doc/setup/usrmgt-server.init', 0600)
1023
except OSError, (errno, strerror):
1024
print "WARNING: Couldn't chmod doc/setup/usrmgt-server.init:"
1025
print "OS error(%s): %s" % (errno, strerror)
1027
print "Successfully wrote lib/conf/usrmgt-server.init"
696
1030
print "You may modify the configuration at any time by editing"
698
1032
print jailconffile
699
1033
print conf_hfile
1035
print usrmgtserver_initdfile
799
1147
# chown trampoline to root and set setuid bit
800
1148
action_chown_setuid(tramppath, dry)
1150
# Create a scripts directory to put the usrmgt-server in.
1151
action_mkdir(os.path.join(ivle_install_dir, 'scripts'), dry)
1152
usrmgtpath = os.path.join(ivle_install_dir, 'scripts/usrmgt-server')
1153
action_copyfile('scripts/usrmgt-server', usrmgtpath, dry)
1154
action_chmod_x(usrmgtpath, dry)
802
1156
# Copy the www and lib directories using the list
803
1157
action_copylist(install_list.list_www, ivle_install_dir, dry)
804
1158
action_copylist(install_list.list_lib, ivle_install_dir, dry)
1160
# Copy the php directory
1161
forum_dir = "www/php/phpBB3"
1162
forum_path = os.path.join(ivle_install_dir, forum_dir)
1163
action_copytree(forum_dir, forum_path, dry)
1164
print "chown -R www-data:www-data %s" % forum_path
1166
os.system("chown -R www-data:www-data %s" % forum_path)
807
1169
# Copy the local jail directory built by the build action