241
238
# In the local file system, where are the subject-independent exercise sheet
242
239
# file spaces located."""))
243
config_options.append(ConfigOption("tos_path",
244
"/home/informatics/tos.html",
245
"""Location where the Terms of Service document is stored (on the local
248
# In the local file system, where is the Terms of Service document located."""))
249
config_options.append(ConfigOption("motd_path",
250
"/home/informatics/motd.html",
251
"""Location where the Message of the Day document is stored (on the local
254
# In the local file system, where is the Message of the Day document
255
# located. This is an HTML file (just the body fragment), which will
256
# be displayed on the login page. It is optional."""))
257
240
config_options.append(ConfigOption("public_host", "public.localhost",
258
241
"""Hostname which will cause the server to go into "public mode",
259
242
providing login-free access to student's published work:""",
810
778
print "Successfully wrote trampoline/conf.h"
812
# Write www/php/phpBB3/config.php
815
conf = open(phpBBconffile, "w")
818
if db_host == 'localhost':
819
forumdb_host = '127.0.0.1'
821
forumdb_host = db_host
824
// phpBB 3.0.x auto-generated configuration file
825
// Do not change anything in this file!
827
$dbhost = '""" + forumdb_host + """';
828
$dbport = '""" + str(db_port) + """';
829
$dbname = '""" + db_forumdbname + """';
830
$dbuser = '""" + db_user + """';
831
$dbpasswd = '""" + db_password + """';
833
$table_prefix = 'phpbb_';
835
$load_extensions = '';
836
@define('PHPBB_INSTALLED', true);
837
// @define('DEBUG', true);
838
//@define('DEBUG_EXTRA', true);
840
$forum_secret = '""" + forum_secret +"""';
844
except IOError, (errno, strerror):
845
print "IO error(%s): %s" % (errno, strerror)
848
print "Successfully wrote www/php/phpBB3/config.php"
850
# Write lib/conf/usrmgt-server.init
853
conf = open(usrmgtserver_initdfile, "w")
855
conf.write( '''#! /bin/sh
857
# Works for Ubuntu. Check before using on other distributions
860
# Provides: usrmgt-server
861
# Required-Start: $syslog $networking $urandom
862
# Required-Stop: $syslog
863
# Default-Start: 2 3 4 5
865
# Short-Description: IVLE user management server
866
# Description: Daemon connecting to the IVLE user management database.
869
PATH=/sbin:/bin:/usr/sbin:/usr/bin
870
DESC="IVLE user management server"
872
DAEMON=/opt/ivle/scripts/$NAME
873
DAEMON_ARGS="''' + str(usrmgt_port) + ''' ''' + usrmgt_magic + '''"
874
PIDFILE=/var/run/$NAME.pid
875
SCRIPTNAME=/etc/init.d/usrmgt-server
877
# Exit if the daemon does not exist
878
test -f $DAEMON || exit 0
880
# Load the VERBOSE setting and other rcS variables
881
[ -f /etc/default/rcS ] && . /etc/default/rcS
883
# Define LSB log_* functions.
884
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
885
. /lib/lsb/init-functions
888
# Function that starts the daemon/service
893
# 0 if daemon has been started
894
# 1 if daemon was already running
895
# 2 if daemon could not be started
896
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
898
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
901
# Add code here, if necessary, that waits for the process to be ready
902
# to handle requests from services started subsequently which depend
903
# on this one. As a last resort, sleep for some time.
907
# Function that stops the daemon/service
912
# 0 if daemon has been stopped
913
# 1 if daemon was already stopped
914
# 2 if daemon could not be stopped
915
# other if a failure occurred
916
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
918
[ "$RETVAL" = 2 ] && return 2
919
# Wait for children to finish too if this is a daemon that forks
920
# and if the daemon is only ever run from this initscript.
921
# If the above conditions are not satisfied then add some other code
922
# that waits for the process to drop all resources that could be
923
# needed by services started subsequently. A last resort is to
924
# sleep for some time.
925
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
926
[ "$?" = 2 ] && return 2
927
# Many daemons don't delete their pidfiles when they exit.
933
# Function that sends a SIGHUP to the daemon/service
937
# If the daemon can reload its configuration without
938
# restarting (for example, when it is sent a SIGHUP),
939
# then implement that here.
941
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
947
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
950
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
951
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
955
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
958
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
959
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
962
#reload|force-reload)
964
# If do_reload() is not implemented then leave this commented out
965
# and leave 'force-reload' as an alias for 'restart'.
967
#log_daemon_msg "Reloading $DESC" "$NAME"
971
restart|force-reload)
973
# If the "reload" option is implemented then remove the
974
# 'force-reload' alias
976
log_daemon_msg "Restarting $DESC" "$NAME"
983
1) log_end_msg 1 ;; # Old process is still running
984
*) log_end_msg 1 ;; # Failed to start
994
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
995
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
1004
except IOError, (errno, strerror):
1005
print "IO error(%s): %s" % (errno, strerror)
1008
# fix permissions as the file contains the database password
1010
os.chmod('doc/setup/usrmgt-server.init', 0600)
1011
except OSError, (errno, strerror):
1012
print "WARNING: Couldn't chmod doc/setup/usrmgt-server.init:"
1013
print "OS error(%s): %s" % (errno, strerror)
1015
print "Successfully wrote lib/conf/usrmgt-server.init"
1018
781
print "You may modify the configuration at any time by editing"
1020
783
print jailconffile
1021
784
print conf_hfile
1023
print usrmgtserver_initdfile