[system] / trunk / webwork / system / system_webwork_setup.pl Repository:
ViewVC logotype

Annotation of /trunk/webwork/system/system_webwork_setup.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 417 - (view) (download) (as text)

1 : sh002i 168 #!/usr/local/bin/perl
2 :    
3 :     ################################################################################
4 :     # WeBWorK
5 :     #
6 :     # Copyright (c) 1995-2001 WeBWorK Team, University of Rochester
7 :     # All rights reserved
8 :     #
9 :     # $Id$
10 :     ################################################################################
11 :    
12 :     #################### initialization
13 :    
14 :     require 5.000;
15 :     use Cwd;
16 :     use File::Copy;
17 :    
18 :     # define built-in defaults
19 : apizer 220 my $DEFAULT_PERL_PATH = '/usr/local/bin/perl';
20 : sh002i 168 my $DEFAULT_CGI_URL = '/cgi-bin/webwork/system/';
21 :     my $DEFAULT_HTML_URL = '/webwork_system_html/';
22 :     my $DEFAULT_ADMIN_GROUP = 'wwadmin';
23 :    
24 :     # define code strings
25 :     my $CGI_DEBUG_TAG = 'WeBWorKCGIDebugURL';
26 :     my $CGI_NODEBUG_TAG = 'WeBWorKCGINoDebugURL';
27 :     my $LIB_INIT_LINE_TAG = 'WeBWorKInitLine';
28 :    
29 :     # scope and undefine setup variables
30 :     $no_prompts = undef;
31 :     $system_setup_mode = undef;
32 :     $mainDir = undef;
33 :     $perlPath = undef;
34 :     $cgiURL = undef;
35 :     $htmlURL = undef;
36 :     $groupName = undef;
37 :     $update_stuff_in_courses = undef;
38 :     $chgrp_files_and_dirs = undef;
39 :     $chmod_files_and_dirs = undef;
40 :     $local_preprocessor = undef;
41 :     $local_postprocessor = undef;
42 :    
43 :     # read defaults in from defaults file
44 :     my $DEFAULTS_FILE;
45 :     if($ARGV[0] and $ARGV[0] eq '-d') {
46 :     if($ARGV[1]) { $DEFAULTS_FILE = $ARGV[1]; }
47 :     else { $DEFAULTS_FILE = ((getpwuid $<)[7]) . '/system_webwork_setup.defaults'; }
48 :     if(-e $DEFAULTS_FILE) {
49 :     print "Reading defaults file...";
50 :     require $DEFAULTS_FILE;
51 :     print " done.\n";
52 :     }
53 :     }
54 :    
55 :     #################### text strings
56 :    
57 :     my $INTRO_TEXT = q{
58 :     +----------------------+
59 :     | System Webwork Setup |
60 :     +----------------------+
61 :    
62 :     This script is used to setup the main WeBWorK system. It will create
63 :     initialization files, set groups and permissions for files and directories,
64 :     and modify files. A "demo" or "working" version of the system can be setup.
65 :    
66 :     You will need the following information:
67 :    
68 : sh002i 174 1) The location of your WeBWorK system directory.
69 :     Example: /usr/local/webwork/system/
70 :     Example: /var/www/webwork/system/
71 : sh002i 168
72 : sh002i 174 2) The path to perl on your system.
73 :     Example: /usr/bin/perl
74 :     Example: /usr/local/bin/perl
75 : sh002i 168
76 : sh002i 174 3) The group containing the users who have the authority to modify the
77 :     webwork system files. Who ever runs this script must be a member of
78 :     this group. (Note: This is not required for the demo mode.)
79 :     Example: wwadmin
80 : sh002i 168
81 : sh002i 174 4) The URL to the WeBWorK CGI scripts.
82 :     Example: /cgi-bin/webwork/system/ (preferred)
83 : sh002i 168
84 : sh002i 174 5) The URL to the static system_html files.
85 :     Example: /webwork_system_html/
86 :    
87 : sh002i 168 };
88 :    
89 :     my $MODE_TEXT = q{
90 :    
91 :     You can set up a "working" or a "demo" WeBWorK system. A "demo" system
92 :     should only be used as a sample system, never for a system that will be used
93 :     with actual courses with real students. The main difference between a
94 :     "working" version and a "demo" version is that in a "working" version you
95 :     will be promped to enter a group (e.g. wwadmin) where as in a "demo"
96 :     version, the group will be set yo your own default group (e.g. fac). Anyone
97 :     in the group will have permission to modify all webwork files. You can set
98 :     up "working" and "demo" courses under either a "working" or a "demo" system,
99 :     but normally you would not set up a "working" course under a "demo" system.
100 :    
101 :     };
102 :    
103 :     my $MAIN_DIR_TEXT = q{
104 :    
105 :     The directory containing the WeBWorK system files (as well as this
106 :     script) is known as the system directory. In order to modify system
107 :     files, I need to know the location of the system directory for this
108 :     installation.
109 :    
110 :     };
111 :    
112 :     my $PERL_TEXT = q{
113 :    
114 :     WeBWorK needs to know the path of your perl binary, so that this
115 :     information can be used in the headers of cgi scripts. Please make sure
116 :     that the version of perl you specify is 5.004 or later.
117 :    
118 :     };
119 :    
120 :     my $CGI_URL_TEXT = q{
121 :    
122 :     In order for generated HTML to be able to invoke CGI scripts, WeBWorK
123 :     needs to know the URL which points to the main WeBWorK system cgi
124 : sh002i 174 subdirectory. If both static HTML and CGIs reside on the same host
125 :     (which is true in most cases), you can omit the http://hostname section
126 :     of the URL, but make sure the leading slash is present.
127 : sh002i 168
128 :     };
129 :    
130 :     my $HTML_URL_TEXT = q{
131 :    
132 :     WeBWorK also needs to know the URL of the main HTML directory, the
133 : sh002i 174 system_html subdirectory. If both static HTML and CGIs reside on the
134 :     same host (which is true in most cases), you can omit the
135 :     http://hostname section of the URL, but make sure the leading slash is
136 :     present.
137 : sh002i 168
138 :     };
139 :    
140 :     my $GROUP_TEXT = q{
141 :    
142 :     WeBWorK needs to know what the admin group is. This group should have been
143 :     set up by your system administrator and must contain at least your user ID.
144 :     All files and directories created will have this as their group.
145 :    
146 :     };
147 :    
148 :     my $COURSE_PERMS_TEXT = q{
149 :    
150 :     You have the option to set permissions for the courses directory. If this is
151 :     an inital setup, you should probably do so. If this is not an initial setup,
152 :     the courses directory is already set up, or the courses directory is shared
153 :     between WeBWorK installations, your probably shouldn't.
154 :    
155 :     };
156 :    
157 :     my $CHGRP_TEXT = q{
158 :    
159 :     You have to option to set the group for all system files and directories. If
160 :     this is an initial setup, you should probably do this. If this is not an
161 :     initial setup, or you have customized the way system files should be
162 :     grouped, you probably shoudn't.
163 :    
164 :     };
165 :    
166 :     my $CHMOD_TEXT = q{
167 :    
168 :     You have to option to set the permissions for all system files and
169 :     directories. If this is an initial setup, you should probably do this. If
170 :     this is not an initial setup, or you have customized the permissions for the
171 :     system files, you probably shoudn't.
172 :    
173 :     };
174 :    
175 :     my $CONFIRM_TEXT = q{
176 :    
177 :     Now that I have the necessary information, I can begin modifying the WeBWorK
178 :     system files.
179 :    
180 :     };
181 :    
182 :     my $DONE_TEXT = q{
183 :    
184 :     The system setup script is done. Please read the above messages
185 :     carefully to determine if there have been any errors. If so, correct the
186 :     problem (usually a permissions problem) and run this script again.
187 :    
188 :     };
189 :    
190 :    
191 :    
192 :    
193 :    
194 :     ################################################################################
195 :     ########## Ask some questions, perform some logic. #############################
196 :     ################################################################################
197 :    
198 :    
199 :    
200 :    
201 :    
202 :     #################### introduction
203 :    
204 :     my $temp;
205 :    
206 :     unless($no_prompts) {
207 :     page($INTRO_TEXT);
208 :     $temp = questionChar("Do you want to continue with setup?", 'y', 'y', 'n');
209 :     exit unless $temp eq 'y';
210 :     }
211 :     print "Okay, here we go...\n";
212 :    
213 :     #################### working or demo?
214 :    
215 :     unless(defined $system_setup_mode) {
216 :     page($MODE_TEXT);
217 :     $temp = questionChar("Shall we set up a working version or a demo version?", 'w', 'w', 'd');
218 :     $system_setup_mode = "working" if $temp eq 'w';
219 :     $system_setup_mode = "demo" if $temp eq 'd';
220 :     }
221 :     print "System setup mode is: $system_setup_mode\n";
222 :    
223 :     #################### main directory
224 :    
225 :     unless(defined $mainDir) {
226 :     page($MAIN_DIR_TEXT);
227 : sh002i 174 $mainDir = questionString("Where is the WeBWorK system directory?", cwd());
228 : sh002i 168 $mainDir .= '/' unless $mainDir =~ m|/$|; # ensure trailing slash
229 :     }
230 :     print "We'll use $mainDir as WeBWorK's system directory.\n";
231 :    
232 :     #################### perl path
233 :    
234 :     unless(defined $perlPath) {
235 :     page($PERL_TEXT);
236 :     $perlPath = questionString("What is the full path to PERL?", $DEFAULT_PERL_PATH);
237 :     }
238 :     print "Path to PERL binary is: $perlPath\n";
239 :    
240 :     #################### CGI URL
241 :    
242 :     unless(defined $cgiURL) {
243 :     page($CGI_URL_TEXT);
244 :     while (1) {
245 :     $cgiURL = questionString("What is the CGI URL?", $DEFAULT_CGI_URL);
246 :     if( ($cgiURL =~ m|^/|) or ($cgiURL =~ m|^http://|) ) {
247 :     last;
248 :     } else {
249 :     $temp = questionChar("That doesn't look like a valid URL. Would you like to use it anyway?", 'n', 'y', 'n');
250 :     last if $temp eq 'y';
251 :     }
252 :     }
253 :     $cgiURL .= "/" unless $cgiURL =~ m"/$"; # ensure trailing slash
254 :     }
255 :     print "CGI URL is: $cgiURL\n";
256 :    
257 :     #################### HTML URL
258 :    
259 :     unless(defined $htmlURL) {
260 :     page($HTML_URL_TEXT);
261 :     while (1) {
262 :     $htmlURL = questionString("What is the HTML URL?", $DEFAULT_HTML_URL);
263 :     if( ($htmlURL =~ m|^/|) or ($htmlURL =~ m|^http://|) ) {
264 :     last;
265 :     } else {
266 :     $temp = questionChar("That doesn't look like a valid URL. Would you like to use it anyway?", 'n', 'y', 'n');
267 :     last if $temp eq 'y';
268 :     }
269 :     }
270 :     $htmlURL .= "/" unless $htmlURL =~ m"/$" ;
271 :     }
272 :     print "HTML URL is: $htmlURL\n";
273 :    
274 :     #################### admin group
275 :    
276 :     unless(defined $groupName) {
277 :     my ($userName, $userGID) = (getpwuid $<)[0,3];
278 :     my $userGroupName = (getgrgid $userGID)[0];
279 :    
280 :     if ($system_setup_mode eq 'demo') {
281 :     # in demo mode, the group is set to the user's primary group
282 :     $groupName = $userGroupName;
283 :     } else {
284 :     # in working mode, we get to chose
285 :     page($GROUP_TEXT);
286 :     while(1) {
287 :     $groupName = questionString("What is the admin group name?", $DEFAULT_ADMIN_GROUP);
288 : sh002i 417 my @group = getgrnam $groupName;
289 :     unless(@group) {
290 :     print "$groupName does not exist.\n";
291 :     next;
292 :     }
293 :     my @members = split / /, $group[3];
294 : sh002i 168 if($groupName eq $userGroupName) {
295 :     print "$groupName is ${userName}'s primary group. Good.\n";
296 : sh002i 417 last;
297 :     } elsif(grep { $_ eq $userName } @members) {
298 : sh002i 168 print "$userName is a member of $groupName. Good.\n";
299 :     last;
300 :     } elsif($< == 0) { # we're root!
301 :     print "$userName isn't a member of $groupName, but you're root, so who cares?\n";
302 :     last;
303 :     } else {
304 : sh002i 417 print "$groupName is not a valid group. Please make sure the group exists and $userName are a member.\n";
305 : sh002i 168 }
306 :     }
307 :     }
308 :     }
309 :     print "Admin group is: $groupName\n";
310 :    
311 :     #################### chmod courses directory
312 :    
313 :     unless(defined $update_stuff_in_courses) {
314 :     page($COURSE_PERMS_TEXT);
315 :     $temp = questionChar("Do you want to set default $system_setup_mode permissions for the courses directory?", 'y', 'y', 'n');
316 :     $update_stuff_in_courses = ($temp eq 'y');
317 :     }
318 :     print "Permissions ", ($update_stuff_in_courses ? "will" : "will not"), " be set for the courses directory.\n";
319 :    
320 :    
321 :     #################### chgrp files/directories
322 :    
323 :     $system_setup_mode eq "demo" and $chgrp_files_and_dirs = 1;
324 :     unless(defined $chgrp_files_and_dirs) {
325 :     page($CHGRP_TEXT);
326 :     $temp = questionChar("Do you want to set the group for system files and directories?", 'y', 'y', 'n');
327 :     $chgrp_files_and_dirs = ($temp eq 'y');
328 :     }
329 :     print "Group ", ($chgrp_files_and_dirs ? "will" : "will not"), " be set for system files and directories.\n";
330 :    
331 :     #################### chmod files/directories
332 :    
333 :     $system_setup_mode eq "demo" and $chmod_files_and_dirs = 1;
334 :     unless(defined $chmod_files_and_dirs) {
335 :     page($CHMOD_TEXT);
336 :     $temp = questionChar("Do you want to set the permissions for system files and directories?", 'y', 'y', 'n');
337 :     $chmod_files_and_dirs = ($temp eq 'y');
338 :     }
339 :     print "Permissions ", ($chmod_files_and_dirs ? "will" : "will not"), " be set for system files and directories.\n";
340 :    
341 :     #################### make sure we want to actually do this
342 :    
343 :     unless($no_prompts) {
344 :     print $CONFIRM_TEXT;
345 :     $temp = questionChar("Do you want to continue with setup?", 'y', 'y', 'n');
346 :     exit unless $temp eq 'y';
347 :     }
348 :     print "\Going to make changes now...\n\n";
349 :    
350 :    
351 :    
352 :    
353 :    
354 :     ################################################################################
355 :     ########## Now we start changing things... #####################################
356 :     ################################################################################
357 :    
358 :    
359 :    
360 :    
361 :    
362 :     #################### run local preprocessor
363 :    
364 :     if(defined $local_preprocessor) {
365 :     print "Executing local preprocessor...\n";
366 :     &$local_preprocessor;
367 :     print "Done with local preprocessor.\n";
368 :     }
369 :    
370 :     #################### update #! and use lines
371 :     # uses: $mainDir, $perlPath
372 :    
373 :     print "Fixing #! lines...\n";
374 :    
375 :     foreach my $dir ("${mainDir}cgi/cgi-scripts", "${mainDir}scripts", "${mainDir}courseScripts") {
376 :     foreach my $file (<${dir}/*.pl>) {
377 :     fixFile($file);
378 :     }
379 :     }
380 :    
381 :     sub fixFile
382 :     {
383 :     my ($file) = @_;
384 :    
385 :     # read the file
386 :     open FILE, $file || die "Couldn't open $file for reading.";
387 :     my @lines = <FILE>;
388 :     close FILE || die "Couldn't close $file after reading.";
389 :    
390 :     # fix perl path
391 :     $lines[0] =~ m/^#!(\S*)/;
392 :     if($1 ne $perlPath) {
393 :     $lines[0] =~ s/^#!\S*/#!$perlPath/;
394 :     open FILE, ">$file" || die "Couldn't open $file for writing.";
395 :     print FILE @lines;
396 :     close FILE || die "Couldn't close $file for writing.";
397 :     }
398 :     }
399 :    
400 :     print "done fixing #! and \"use\" lines.\n\n";
401 :    
402 :     #################### write webworkConfig.pm file
403 :     # uses: $mainDir, $cgiURL, $htmlURL
404 :    
405 :     print "Writing lib/webworkConfig.pm file...\n";
406 :     open CONFIG_FILE, ">${mainDir}lib/webworkConfig.pm";
407 :     print CONFIG_FILE<<END_OF_CONFIG_FILE;
408 :     package Global;
409 :    
410 :     ################################################################################
411 :     # WeBWorK
412 :     #
413 :     # Copyright (c) 1995-2001 WeBWorK Team, University of Rochester
414 :     # All rights reserved
415 :     ################################################################################
416 :    
417 : apizer 228 # \$cgiDebugMode, if enabled, will call the debug wrapper scripts instead of the
418 : apizer 217 # cgi scripts themselves, allowing for header output, etc. In addition to
419 : apizer 228 # setting \$cgiDebugMode =1, you will also need to enable debugging in the
420 :     # wrapper scripts that you wish to debug, by setting \$debug = 1. Wrapper
421 :     # scripts are found in the directory referred to by \$cgiWebworkURL, which is
422 : apizer 217 # usually webwork/system/cgi.
423 :     \$cgiDebugMode = 0;
424 :    
425 : sh002i 168 \$mainDirectory = "$mainDir";
426 :     \$htmlWebworkURL = "$htmlURL";
427 : sh002i 174 \$cgiWebworkURL = "$cgiURL";
428 : sh002i 168 \$cgiWebworkURL .= "cgi-scripts/" unless \$cgiDebugMode;
429 :    
430 :     1;
431 :     END_OF_CONFIG_FILE
432 :     close CONFIG_FILE;
433 :     print "Done writing lib/webworkConfig.pm file.\n\n";
434 :    
435 :     #################### write webworkInit.pm files
436 :     # uses: $mainDir
437 :    
438 :     print "Writing webworkInit.pm files...\n";
439 :     foreach my $dir ('cgi/', 'cgi/cgi-scripts/', 'scripts/', 'courseScripts/') {
440 :     open INIT_FILE, ">$mainDir${dir}webworkInit.pm";
441 :     print INIT_FILE<<END_OF_INIT_FILE;
442 :     ################################################################################
443 :     # WeBWorK
444 :     #
445 :     # Copyright (c) 1995-2001 WeBWorK Team, University of Rochester
446 :     # All rights reserved
447 :     ################################################################################
448 :    
449 :     use lib '${mainDir}lib/';
450 :    
451 :     1;
452 :     END_OF_INIT_FILE
453 :     close INIT_FILE;
454 :     }
455 :     print "Done writing webworkInit.pm files.\n\n";
456 :    
457 :     #################### chgrp system stuff
458 :     # uses: $chgrp_files_and_dirs, $groupName
459 :    
460 :     if($chgrp_files_and_dirs) {
461 :     print "Setting group on system files and directories...\n";
462 :     system "chgrp -R $groupName $mainDir";
463 : sh002i 174 system "chgrp -R $groupName $mainDir/../system_html";
464 : sh002i 168 print "Done setting group.\n\n";
465 :     }
466 :    
467 :     #################### chmod system stuff
468 :     # uses: $chmod_files_and_dirs
469 :    
470 :     if($chmod_files_and_dirs) {
471 :     print "Setting permissions on system files and directories for $system_setup_mode mode...\n";
472 :     if ($system_setup_mode eq "demo") {
473 :     # get some general permissions for files and directories
474 : apizer 231 system "find $mainDir $mainDir/../system_html -type d -print | xargs chmod 0755";
475 :     system "find $mainDir $mainDir/../system_html -type f -print | xargs chmod 0644";
476 : sh002i 168 # add executable privs to scripts
477 : apizer 231 system "find ${mainDir}cgi ${mainDir}scripts -type f -print | xargs chmod 0755";
478 : sh002i 168 } else {
479 :     # get some general permissions for files and directories
480 : apizer 231 system "find $mainDir $mainDir/../system_html -type d -print | xargs chmod 0775";
481 :     system "find $mainDir $mainDir/../system_html -type f -print | xargs chmod 0664";
482 : sh002i 168 # add executable privs to scripts
483 : apizer 231 system "find ${mainDir}cgi ${mainDir}scripts -type f -print | xargs chmod 0775";
484 : sh002i 168 }
485 : apizer 225 # make the log files group writable
486 : apizer 231 system "find $mainDir/logs -type f -print | xargs chmod 0664";
487 : apizer 224 # make the error_log file world writable
488 : apizer 231 system "find $mainDir/logs/error_log -print | xargs chmod 0666";
489 : apizer 224
490 : sh002i 168 print "done setting permissions.\n\n";
491 :     }
492 :    
493 :     #################### update couses stuff
494 :     # uses: $update_stuff_in_courses
495 :    
496 :     if($update_stuff_in_courses) {
497 : sh002i 177 print "Setting permissions for ../courses directory...\n";
498 :     if ($system_setup_mode eq "demo") {
499 :     chmod(0755, "$mainDir/../courses") or warn "Warning: I can't set permissions for ../courses directory. It's possible that the directory doesn't exist or you don't have permission to change it.\n";
500 :     } else {
501 :     chmod(0775, "$mainDir/../courses") or warn "Warning: I can't set permissions for ../courses directory. It's possible that the directory doesn't exist or you don't have permission to change it.\n";
502 :     }
503 :     print "done permissions.\n\n";
504 : sh002i 168 }
505 :    
506 :     #################### run local postprocessor
507 :    
508 :     if(defined $local_postprocessor) {
509 :     print "Executing local postprocessor...\n";
510 :     &$local_postprocessor;
511 :     print "Done with local postprocessor.\n";
512 :     }
513 :    
514 :     #################### finish up
515 :    
516 :     page($DONE_TEXT);
517 :    
518 :     ################################################################################
519 :    
520 :     sub page
521 :     {
522 :     my @string_lines = split /^/, shift; #/
523 :     # not really optimal, but we're going to assume a constant screen height.
524 :     my $SCREEN_HEIGHT = 20;
525 :     while(@string_lines) {
526 :     print join "", @string_lines[0..($SCREEN_HEIGHT>scalar @string_lines ? (scalar @string_lines)-1 : $SCREEN_HEIGHT-1)];
527 :     if(scalar @string_lines >= $SCREEN_HEIGHT) {
528 :     print "\n[Press ENTER to continues...]";
529 :     <STDIN>;
530 :     print "\n";
531 :     }
532 :     @string_lines = @string_lines[$SCREEN_HEIGHT..$#string_lines];
533 :     }
534 :     }
535 :    
536 :     sub questionChar
537 :     {
538 :     my ($question, $default, @valid) = @_;
539 :     my $answer;
540 :     do {
541 :     print $question, " ";
542 :     foreach (@valid) {
543 :     $_ eq $default and print "[";
544 :     print $_;
545 :     $_ eq $default and print "]";
546 :     }
547 :     print " ";
548 :     $answer = <STDIN>;
549 :     $answer =~ s/^\s*//;
550 :     $answer = substr $answer, 0, 1;
551 :     $answer = lc $answer;
552 :     $answer or $answer = $default;
553 :     } while (not grep(/$answer/, @valid));
554 :     return $answer;
555 :     }
556 :    
557 :     sub questionString
558 :     {
559 :     my ($question, $default, $emptyOK) = @_;
560 :     my $answer;
561 :     print $question, " [", $default, "] ";
562 :     $answer = <STDIN>;
563 :     chomp $answer;
564 :     $answer =~ s/^\s*//;
565 :     $answer or $answer = $default;
566 :     return $answer;
567 :     }
568 :    
569 :     __END__
570 :    
571 :     =head1 NAME
572 :    
573 :     system_webwork_setup.pl - set up the WeBWorK system
574 :    
575 :     =head1 SYNOPSIS
576 :    
577 :     system_webwork_setup.pl [B<-d> [defaults-file]]
578 :    
579 :     =head1 DESCRIPTION
580 :    
581 :     B<system_webwork_setup.pl> gathers the information necessary for configuration of the WeBWorK system. It then edits several WeBWorK system files, and creates F<webworkInit.pm> modules and the F<webworkConfig.pm> module based on the information gathered. It can optionally read defaults from a file specified on the command line or from the file F<$HOME/system_webwork_setup.defaults>.
582 :    
583 :     =head1 OPTIONS
584 :    
585 :     =over 4
586 :    
587 :     =item B<-d>
588 :    
589 :     enables defaults-file processing. If no defaults-file is specified, the file F<$HOME/system_webwork_setup.defaults> will be used.
590 :    
591 :     =head1 DEFAULTS
592 :    
593 :     The F<system_webwork_setup.defaults> file is intended to be used in a situation where B<system_webwork_setup.pl> must be executed frequently, such as in the case of use with CVS, in which the it must be executed after a checkout and some updates. The defaults file is a perl script that will be require'd by B<system_webwork_setup.pl>. It can set any of the following variables in the usual way:
594 :    
595 :     =over 4
596 :    
597 :     =item $no_prompts
598 :    
599 :     Refrain from prompting at the beginning of the script and before making changes. Also supresses the introductory text.
600 :    
601 :     =item $system_setup_mode
602 :    
603 :     Can be set to "working" or "demo". This affects how system file permissions and group ownership are set. In "working" mode, system files are group owned by a webwork admin group (see I<$groupName>) and group writeable while in "demo" mode files are group owned by the current user's default group and are not group writeable.
604 :    
605 :     =item $mainDir
606 :    
607 :     Specify WeBWorK's main directory, which should contain the directories cgi/ scripts/ courseScripts/ and lib/.
608 :    
609 :     =item $perlPath
610 :    
611 :     Specify the path to the perl interpreter which should be used. This is used to set the shebang line in cgi-scripts and scripts.
612 :    
613 :     =item $cgiURL
614 :    
615 :     Specify the externally visible URL to the CGI directory (typically cgi/cgi-scripts/). This will be used when scripts call other scripts.
616 :    
617 :     =item $htmlURL
618 :    
619 :     Specify the externally visible URL to the HTML directory (typically system_html/). This will be used when scripts refer to static graphics and text.
620 :    
621 :     =item $groupName
622 :    
623 :     When in "working" mode, I<$groupName> is the name of the WeBWorK admin group, members of which should have write access to the system files. (The web server should not be in this group!)
624 :    
625 :     =item $update_stuff_in_courses
626 :    
627 :     If true, B<system_webwork_setup.pl> will set permissions in the courses directory and prepare the B<course_webwork_setup.pl> script for execution.
628 :    
629 :     =item $chgrp_files_and_dirs, $chmod_files_and_dirs
630 :    
631 :     If true, the group and/or permissions on system files will be set according to I<$system_setup_mode>.
632 :    
633 :     =item $local_preprocessor, $local_postprocessor
634 :    
635 :     If set, these variables will be called as subroutine references. I<$local_preprocessor> is called before any changes take place, while I<$local_postprocessor> is called after all changes have taken place.
636 :    
637 :     =back
638 :    
639 :     =head1 FILES
640 :    
641 :     $HOME/system_webwork_setup.defaults
642 :    
643 :     =head1 AUTHOR
644 :    
645 :     Samuel Hathaway <sh002i@math.rochester.edu>

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9