51
51
# Set up some variables
54
# conffile is the file that will be created/overwritten
54
# the files that will be created/overwritten
55
55
conffile = os.path.join(cwd, "www/conf/conf.py")
56
conf_hfile = os.path.join(cwd, "trampoline/conf.h")
57
58
# Fixed config options that we don't ask the admin
70
71
print """IVLE Setup
71
This tool will create the file """ + conffile + """,
72
This tool will create the following files:
72
75
prompting you for details about your configuration. The file will be
73
76
overwritten if it already exists. It will *not* install or deploy IVLE.
75
78
Please hit Ctrl+C now if you do not wish to do this.
79
""" % (conffile, conf_hfile)
78
81
# Get information from the administrator
79
82
# If EOF is encountered at any time during the questioning, just exit silently
81
84
root_dir = query_user("""Root directory where IVLE is located (in URL space):
82
85
(eg. "/" or "/ivle")""")
86
ivle_install_dir = query_user('Root directory where IVLE is located (on the '
87
'local file system):\n'
88
'(eg. "/home/informatics/ivle")')
83
89
student_dir = query_user(
84
90
"""Root directory where user files are stored (on the local file system):
85
91
(eg. "/home/informatics/jails")""")
90
96
conf = open(conffile, "w")
97
103
# In URL space, where in the site is IVLE located. (All URLs will be prefixed
99
105
# eg. "/" or "/ivle".
100
root_dir = """ + '"' + root_dir + '"' + """
108
# In the local file system, where IVLE is actually installed.
109
# This directory should contain the "www" and "bin" directories.
110
ivle_install_dir = "%s"
102
112
# In the local file system, where are the student/user file spaces located.
103
113
# The user jails are expected to be located immediately in subdirectories of
105
student_dir = """ + '"' + student_dir + '"' + """
107
117
# Which application to load by default (if the user navigates to the top level
108
118
# of the site). This is the app's URL name.
109
119
# Note that if this app requires authentication, the user will first be
110
120
# presented with the login screen.
111
default_app = """ + '"' + default_app + '"' + """
122
""" % (root_dir, ivle_install_dir, student_dir, default_app))
115
125
except IOError, (errno, strerror):
116
126
print "IO error(%s): %s" % (errno, strerror)
119
print "Successfully wrote conf.py"
129
print "Successfully wrote www/conf.py"
131
# Write trampoline/conf.h
134
conf = open(conf_hfile, "w")
136
conf.write("""/* IVLE Configuration File
138
* Administrator settings required by trampoline.
139
* Note: trampoline will have to be rebuilt in order for changes to this file
143
/* In the local file system, where are the jails located.
144
* The trampoline does not allow the creation of a jail anywhere besides
145
* jail_base or a subdirectory of jail_base.
147
static const char* jail_base = "%s";
151
except IOError, (errno, strerror):
152
print "IO error(%s): %s" % (errno, strerror)
155
print "Successfully wrote trampoline/conf.h"
121
158
print "You may modify the configuration at any time by editing"