Parent Directory
|
Revision Log
changed comments
1 #!/usr/local/bin/perl 2 3 ################################################################################ 4 # WeBWorK 5 # 6 # Copyright (c) 1995-2001 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 my $DEFAULT_PERL_PATH = '/usr/bin/perl'; 20 my $DEFAULT_CGI_URL = '/cgi-bin/webwork/system/'; 21 my $DEFAULT_HTML_URL = '/webwork_system_html'; 22 my $DEFAULT_SERVER_GROUP = 'webwork'; 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 $serverGroupName = undef; 38 $update_stuff_in_courses = undef; 39 $chgrp_files_and_dirs = undef; 40 $chmod_files_and_dirs = undef; 41 $local_preprocessor = undef; 42 $local_postprocessor = undef; 43 44 # read defaults in from defaults file 45 my $DEFAULTS_FILE; 46 if($ARGV[0]) { $DEFAULTS_FILE = $ARGV[0]; } 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 #################### text strings 55 56 my $INTRO_TEXT = q{ 57 +----------------------+ 58 | System Webwork Setup | 59 +----------------------+ 60 61 This script is used to setup the main WeBWorK system. It will create 62 initialization files, set groups and permissions for files and directories, 63 and modify files. A "demo" or "working" version of the system can be setup. 64 65 You will need the following information: 66 67 1) The path to perl on your system. Usually this is something like 68 /usr/bin/perl or /usr/local/bin/perl 69 70 2) The group (e.g. wwadmin) containing the user names of anyone who has the 71 authority to modify the webwork system files. Who ever runs this script must 72 be a member of this group. This should be set up by your system 73 administrator before running this script. (Note: This is not required for a 74 demo version.) 75 76 3) The cgi WeBWorK URL. Usually this is something like 77 http://www.math.rochester.edu/cgi-bin/webwork/system or 78 http://webwork.math.rochester.edu/cgi-bin/webwork/system. In the above 79 cases, you can just enter /cgi-bin/webwork/system which is prefered but if 80 you do, don't forget the initial / . 81 82 4) The html WeBWorK URL. Usually this is something like 83 http://www.math.rochester.edu/webwork_system_html. Again in this case 84 /webwork_system_html is prefered. 85 86 See the html document 87 webwork/system/system_html/docs/techdescription/settingupsystem.html for 88 detailed explanations. The examples here are taken from those directions. 89 90 }; 91 92 my $MODE_TEXT = q{ 93 94 You can set up a "working" or a "demo" WeBWorK system. A "demo" system 95 should only be used as a sample system, never for a system that will be used 96 with actual courses with real students. The main difference between a 97 "working" version and a "demo" version is that in a "working" version you 98 will be promped to enter a group (e.g. wwadmin) where as in a "demo" 99 version, the group will be set yo your own default group (e.g. fac). Anyone 100 in the group will have permission to modify all webwork files. You can set 101 up "working" and "demo" courses under either a "working" or a "demo" system, 102 but normally you would not set up a "working" course under a "demo" system. 103 104 }; 105 106 my $MAIN_DIR_TEXT = q{ 107 108 The directory containing the WeBWorK system files (as well as this 109 script) is known as the main directory. In order to modify system files, 110 I need to know where the main directory for this installation is. If you 111 invoked this script as ./system_webwork_setup.pl, then you are already 112 in the main directory and can accept the default. 113 114 }; 115 116 my $PERL_TEXT = q{ 117 118 WeBWorK needs to know the path of your perl binary, so that this information 119 can be used in the headers of cgi scripts. If you were able to run this 120 script by typing "./system_webwork_setup.pl", the path to a perl binary is 121 listed on the first line of this script. 122 123 }; 124 125 my $CGI_URL_TEXT = q{ 126 127 In order for generated HTML to be able to invoke CGI scripts, WeBWorK needs 128 to know the URL which points to the main WeBWorK system cgi subdirectory. 129 For example, http://www.math.rochester.edu.edu/cgi-bin/webwork/system might 130 be a valid CGI URL. If both static HTML and CGIs reside on the same host 131 (which is true in most cases), you can omit the 132 http://www.math.rochester.edu section of the URL. Make sure to include a 133 leading slash in this case. 134 135 }; 136 137 my $HTML_URL_TEXT = q{ 138 139 WeBWorK also needs to know the URL of the main HTML directory, the system 140 html subdirectory. For example, 141 http://www.math.rochester.edu/webwork_system_html or /webwork_system_html. 142 143 }; 144 145 my $GROUP_TEXT = q{ 146 147 WeBWorK needs to know what the admin group is. This group should have been 148 set up by your system administrator and must contain at least your user ID. 149 All files and directories created will have this as their group. 150 151 }; 152 153 my $SERVER_GROUP_TEXT = q{ 154 155 In order to give the webserver access to the logs directory, WeBWorK 156 must know the group under which the web server will run. If you are 157 running this script as a user other than root, you will need to be a 158 member of the server's group in order to set the group on the logs 159 directory. If you are not running as root and you are not a member of 160 the server's group, you can skip this step and change the group manually 161 later. To skip this step, type SKIP below. 162 163 }; 164 165 my $COURSE_PERMS_TEXT = q{ 166 167 You have the option to set permissions for the courses directory. If this is 168 an inital setup, you should probably do so. If this is not an initial setup, 169 the courses directory is already set up, or the courses directory is shared 170 between WeBWorK installations, your probably shouldn't. 171 172 }; 173 174 my $CHGRP_TEXT = q{ 175 176 You have to option to set the group for all system files and directories. If 177 this is an initial setup, you should probably do this. If this is not an 178 initial setup, or you have customized the way system files should be 179 grouped, you probably shoudn't. 180 181 }; 182 183 my $CHMOD_TEXT = q{ 184 185 You have to option to set the permissions for all system files and 186 directories. If this is an initial setup, you should probably do this. If 187 this is not an initial setup, or you have customized the permissions for the 188 system files, you probably shoudn't. 189 190 }; 191 192 my $CONFIRM_TEXT = q{ 193 194 Now that I have the necessary information, I can begin modifying the WeBWorK 195 system files. 196 197 }; 198 199 my $DONE_TEXT = q{ 200 201 The system setup script is done. Your WeBWorK system directory is now set up 202 correctly. 203 204 }; 205 206 207 208 209 210 ################################################################################ 211 ########## Ask some questions, perform some logic. ############################# 212 ################################################################################ 213 214 215 216 217 218 #################### introduction 219 220 my $temp; 221 222 unless($no_prompts) { 223 page($INTRO_TEXT); 224 $temp = questionChar("Do you want to continue with setup?", 'y', 'y', 'n'); 225 exit unless $temp eq 'y'; 226 } 227 print "Okay, here we go...\n"; 228 229 #################### working or demo? 230 231 unless(defined $system_setup_mode) { 232 page($MODE_TEXT); 233 $temp = questionChar("Shall we set up a working version or a demo version?", 'w', 'w', 'd'); 234 $system_setup_mode = "working" if $temp eq 'w'; 235 $system_setup_mode = "demo" if $temp eq 'd'; 236 } 237 print "System setup mode is: $system_setup_mode\n"; 238 239 #################### main directory 240 241 unless(defined $mainDir) { 242 page($MAIN_DIR_TEXT); 243 $mainDir = questionString("Where is the main WeBWorK directory?", cwd()); 244 $mainDir .= '/' unless $mainDir =~ m|/$|; # ensure trailing slash 245 } 246 print "We'll use $mainDir as WeBWorK's home.\n"; 247 248 #################### perl path 249 250 unless(defined $perlPath) { 251 page($PERL_TEXT); 252 $perlPath = questionString("What is the full path to PERL?", $DEFAULT_PERL_PATH); 253 } 254 print "Path to PERL binary is: $perlPath\n"; 255 256 #################### CGI URL 257 258 unless(defined $cgiURL) { 259 page($CGI_URL_TEXT); 260 while (1) { 261 $cgiURL = questionString("What is the CGI URL?", $DEFAULT_CGI_URL); 262 if( ($cgiURL =~ m|^/|) or ($cgiURL =~ m|^http://|) ) { 263 last; 264 } else { 265 $temp = questionChar("That doesn't look like a valid URL. Would you like to use it anyway?", 'n', 'y', 'n'); 266 last if $temp eq 'y'; 267 } 268 } 269 $cgiURL .= "/" unless $cgiURL =~ m"/$"; # ensure trailing slash 270 } 271 print "CGI URL is: $cgiURL\n"; 272 273 #################### HTML URL 274 275 unless(defined $htmlURL) { 276 page($HTML_URL_TEXT); 277 while (1) { 278 $htmlURL = questionString("What is the HTML URL?", $DEFAULT_HTML_URL); 279 if( ($htmlURL =~ m|^/|) or ($htmlURL =~ m|^http://|) ) { 280 last; 281 } else { 282 $temp = questionChar("That doesn't look like a valid URL. Would you like to use it anyway?", 'n', 'y', 'n'); 283 last if $temp eq 'y'; 284 } 285 } 286 $htmlURL .= "/" unless $htmlURL =~ m"/$" ; 287 } 288 print "HTML URL is: $htmlURL\n"; 289 290 #################### admin group 291 292 unless(defined $groupName) { 293 my ($userName, $userGID) = (getpwuid $<)[0,3]; 294 my $userGroupName = (getgrgid $userGID)[0]; 295 296 if ($system_setup_mode eq 'demo') { 297 # in demo mode, the group is set to the user's primary group 298 $groupName = $userGroupName; 299 } else { 300 # in working mode, we get to chose 301 page($GROUP_TEXT); 302 my $validGroup = 0; 303 while(1) { 304 $groupName = questionString("What is the admin group name?", $userGroupName); 305 my @members = split / /, (getgrnam $groupName)[3]; 306 if($groupName eq $userGroupName) { 307 print "$groupName is ${userName}'s primary group. Good.\n"; 308 } elsif(grep /$userName/, @members) { 309 print "$userName is a member of $groupName. Good.\n"; 310 last; 311 } elsif($< == 0) { # we're root! 312 print "$userName isn't a member of $groupName, but you're root, so who cares?\n"; 313 last; 314 } else { 315 print "That group is not valid. Please make sure the group exists and you are a member.\n"; 316 } 317 } 318 } 319 } 320 print "Admin group is: $groupName\n"; 321 322 #################### server group 323 324 unless(defined $serverGroupName) { 325 page($SERVER_GROUP_TEXT); 326 my ($userName, $userGID) = (getpwuid $<)[0,3]; 327 my $userGroupName = (getgrgid $userGID)[0]; 328 $serverGroupName = $DEFAULT_SERVER_GROUP; 329 my $validGroup = 0; 330 while(1) { 331 $serverGroupName = questionString("What is the webserver group name?", $serverGroupName); 332 $serverGroupName eq "SKIP" and last; 333 my @members = split / /, (getgrnam $serverGroupName)[3]; 334 if($serverGroupName eq $userGroupName) { 335 print "$serverGroupName is ${userName}'s primary group. Weird.\n"; 336 } elsif(grep /$userName/, @members) { 337 print "$userName is a member of $serverGroupName. Good.\n"; 338 last; 339 } elsif($< == 0) { # we're root! 340 print "$userName isn't a member of $serverGroupName, but you're root, so who cares?\n"; 341 last; 342 } else { 343 print "That group is not valid. Please make sure the group exists and you are a member.\n"; 344 } 345 } 346 } 347 print "Server group is: $serverGroupName\n"; 348 349 #################### chmod courses directory 350 351 unless(defined $update_stuff_in_courses) { 352 page($COURSE_PERMS_TEXT); 353 $temp = questionChar("Do you want to set default $system_setup_mode permissions for the courses directory?", 'y', 'y', 'n'); 354 $update_stuff_in_courses = ($temp eq 'y'); 355 } 356 print "Permissions ", ($update_stuff_in_courses ? "will" : "will not"), " be set for the courses directory.\n"; 357 358 359 #################### chgrp files/directories 360 361 $system_setup_mode eq "demo" and $chgrp_files_and_dirs = 1; 362 unless(defined $chgrp_files_and_dirs) { 363 page($CHGRP_TEXT); 364 $temp = questionChar("Do you want to set the group for system files and directories?", 'y', 'y', 'n'); 365 $chgrp_files_and_dirs = ($temp eq 'y'); 366 } 367 print "Group ", ($chgrp_files_and_dirs ? "will" : "will not"), " be set for system files and directories.\n"; 368 369 #################### chmod files/directories 370 371 $system_setup_mode eq "demo" and $chmod_files_and_dirs = 1; 372 unless(defined $chmod_files_and_dirs) { 373 page($CHMOD_TEXT); 374 $temp = questionChar("Do you want to set the permissions for system files and directories?", 'y', 'y', 'n'); 375 $chmod_files_and_dirs = ($temp eq 'y'); 376 } 377 print "Permissions ", ($chmod_files_and_dirs ? "will" : "will not"), " be set for system files and directories.\n"; 378 379 #################### make sure we want to actually do this 380 381 unless($no_prompts) { 382 print $CONFIRM_TEXT; 383 $temp = questionChar("Do you want to continue with setup?", 'y', 'y', 'n'); 384 exit unless $temp eq 'y'; 385 } 386 print "\Going to make changes now...\n\n"; 387 388 389 390 391 392 ################################################################################ 393 ########## Now we start changing things... ##################################### 394 ################################################################################ 395 396 397 398 399 400 chdir $mainDir; 401 402 #################### run local preprocessor 403 404 if(defined $local_preprocessor) { 405 print "Executing local preprocessor...\n"; 406 &$local_preprocessor; 407 print "Done with local preprocessor.\n"; 408 } 409 410 #################### update Global.pm 411 #needs: $mainDir, $cgiURL, $htmlURL 412 413 #chdir "lib"; 414 # 415 #-e 'Global.pm' or die "Global.pm doesn't exist! There's no point in continuing.\n"; 416 #if(-e 'Global.pm.bak1') { 417 # print "Copying Global.pm.bak1 -> Global.pm.bak2\n"; 418 # copy('Global.pm.bak1', 'Global.pm.bak2'); 419 #} 420 #print "Copying Global.pm -> Global.pm.bak1\n"; 421 #copy('Global.pm', 'Global.pm.bak1'); 422 # 423 #open OLD_GLOBAL, "Global.pm.bak1"; 424 #open NEW_GLOBAL, ">Global.pm"; 425 # 426 #while (<OLD_GLOBAL>) { 427 # if (/^\$mainDirectory/) { 428 # print NEW_GLOBAL "\$mainDirectory = '$mainDir';\n"; 429 # print "\$mainDirectory = '$mainDir';\n"; 430 # } elsif (/\#$CGI_DEBUG_TAG$/) { 431 # print NEW_GLOBAL "\#\$cgiWebworkURL = '$cgiURL'; \#$CGI_DEBUG_TAG\n"; 432 # print "\#\$cgiWebworkURL = '$cgiURL'; \#$CGI_DEBUG_TAG\n"; 433 # } elsif (/\#$CGI_NODEBUG_TAG$/) { 434 # print NEW_GLOBAL "\$cgiWebworkURL = '${cgiURL}cgi-scripts/'; \#$CGI_NODEBUG_TAG\n"; 435 # print "\$cgiWebworkURL = '${cgiURL}cgi-scripts/'; \#$CGI_NODEBUG_TAG\n"; 436 # } elsif (/^\$htmlWebworkURL/) { 437 # print NEW_GLOBAL "\$htmlWebworkURL = '$htmlURL';\n"; 438 # print "\$htmlWebworkURL = '$htmlURL';\n"; 439 # } else { 440 # print NEW_GLOBAL $_; 441 # } 442 #} 443 # 444 #close NEW_GLOGAL; 445 #close OLD_GLOBAL; 446 # 447 #chmod(0644, "Global.pm"); 448 #chdir ".."; 449 #print "Done updating Global.pm\n\n"; 450 451 #################### update #! and use lines 452 # uses: $mainDir, $perlPath 453 454 print "Fixing #! lines...\n"; 455 456 # fix up the course setup script and the *.pl files 457 fixFile('../courses/demoCourse/course_webwork_setup.pl') if $update_stuff_in_courses; 458 foreach my $dir ('cgi/cgi-scripts', 'scripts', 'courseScripts') { 459 foreach my $file (<${dir}/*.pl>) { 460 fixFile($file); 461 } 462 } 463 464 sub fixFile 465 { 466 my ($file) = @_; 467 468 # read the file 469 open FILE, $file || die "Couldn't open $file for reading."; 470 my @lines = <FILE>; 471 close FILE || die "Couldn't close $file after reading."; 472 473 # fix perl path 474 $lines[0] =~ m/^#!(\S*)/; 475 if($1 ne $perlPath) { 476 $lines[0] =~ s/^#!\S*/#!$perlPath/; 477 open FILE, ">$file" || die "Couldn't open $file for writing."; 478 print FILE @lines; 479 close FILE || die "Couldn't close $file for writing."; 480 } 481 } 482 483 print "done fixing #! and \"use\" lines.\n\n"; 484 485 #################### write webworkConfig.pm file 486 # uses: $mainDir, $cgiURL, $htmlURL 487 488 print "Writing lib/webworkConfig.pm file...\n"; 489 open CONFIG_FILE, ">${mainDir}lib/webworkConfig.pm"; 490 print CONFIG_FILE 491 "package Global;\n\n", 492 "\$cgiWebworkURL = \"${cgiURL}cgi-scripts/\";\n", 493 "\$htmlWebworkURL = \"$htmlURL\";\n", 494 "\$mainDirectory = \"$mainDir\";\n\n", 495 "1;"; 496 close CONFIG_FILE; 497 print "Done writing lib/webworkConfig.pm file.\n\n"; 498 499 #################### write webworkInit.pm files 500 # uses: $mainDir 501 502 print "Writing webworkInit.pm files...\n"; 503 foreach my $dir ('cgi/', 'cgi/cgi-scripts/', 'scripts/', 'courseScripts/') { 504 open INIT_FILE, ">$mainDir${dir}webworkInit.pm"; 505 print INIT_FILE 506 "use lib '${mainDir}lib/';\n\n", 507 "1;"; 508 close INIT_FILE; 509 } 510 print "Done writing webworkInit.pm files.\n\n"; 511 512 #################### chgrp system stuff 513 # uses: $chgrp_files_and_dirs, $groupName, $serverGroupName 514 515 if($chgrp_files_and_dirs) { 516 print "Setting group on system files and directories...\n"; 517 # R=recursive, P=don't follow symlinks 518 system "chgrp -PR $groupName ."; 519 system "chgrp -PR $serverGroupName logs/" unless $serverGroupName eq "SKIP"; 520 print "Done setting group.\n\n"; 521 } 522 523 #################### chmod system stuff 524 # uses: $chmod_files_and_dirs 525 526 if($chmod_files_and_dirs) { 527 print "Setting permissions on system files and directories for $system_setup_mode mode...\n"; 528 if ($system_setup_mode eq "demo") { 529 # get some general permissions for files and directories 530 system "find . -type d -print0 | xargs -0 chmod 0711"; 531 system "find . -type f -print0 | xargs -0 chmod 0644"; 532 # add executable privs to scripts 533 system "find cgi scripts -type f -print0 | xargs -0 chmod 0755"; 534 # give everyone write access to logs 535 # (we should probably just be chowning the log directory to the webserver) 536 system "chmod 0666 logs/*"; 537 # make this script executable and safe 538 system "chmod 0700 system_webwork_setup.pl" 539 } else { 540 # get some general permissions for files and directories 541 system "find . -type d -print0 | xargs -0 chmod 0771"; 542 system "find . -type f -print0 | xargs -0 chmod 0664"; 543 # add executable privs to scripts 544 system "find cgi scripts -type f -print0 | xargs -0 chmod 0775"; 545 # give everyone write access to logs 546 # (we should probably just be chowning the log directory to the webserver) 547 system "find logs -type f -print0 | xargs -0 chmod 0666"; 548 # make this script executable and safe 549 system "chmod 0770 system_webwork_setup.pl" 550 } 551 print "done setting permissions.\n\n"; 552 } 553 554 #################### fix up the documemtation html files 555 # uses: $htmlURL, $cgiURL 556 557 print "Fixing image, cgi-bin, and ref lines in documentation html files...\n"; 558 foreach my $dir ('system_html/helpFiles') { 559 foreach my $file (<${dir}/*.html>) { 560 open FILE, $file || die "CAN'T READ $file!\n Fix the problem and run the setup script again"; 561 my @lines = <FILE>; 562 close FILE || die "CAN'T CLOSE $file!\n Fix the problem and run the setup script again"; 563 564 foreach my $line (@lines) { 565 $line =~ s|<IMG SRC=".*?images/|<IMG SRC="${htmlURL}images/|g; # fix "images" line 566 $line =~ s|<A HREF=".*?feedback.pl">|<A HREF="${cgiURL}feedback.pl">|g; # fix "cgi-bin" line 567 $line =~ s|<A HREF=".*?docs/">|<A HREF="${htmlURL}docs/">|g; # fix "Ref" line 568 } 569 open FILE, ">$file" || die "CAN'T WRITE $file!\n Fix the problem and run the setup script again"; 570 print FILE @lines; 571 close FILE || die "CAN'T CLOSE (writing) $file!\n Fix the problem and run the setup script again"; 572 } 573 } 574 print "done fixing documentation files.\n\n"; 575 576 #################### update couses stuff 577 # uses: $update_stuff_in_courses 578 579 if($update_stuff_in_courses) { 580 print "Setting permissions for ../courses directory.\n\n"; 581 chmod(0755, '../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"; 582 } 583 584 #################### run local postprocessor 585 586 if(defined $local_postprocessor) { 587 print "Executing local postprocessor...\n"; 588 &$local_postprocessor; 589 print "Done with local postprocessor.\n"; 590 } 591 592 #################### finish up 593 594 page($DONE_TEXT); 595 596 ################################################################################ 597 598 sub page 599 { 600 my @string_lines = split /^/, shift; #/ 601 # not really optimal, but we're going to assume a constant screen height. 602 my $SCREEN_HEIGHT = 20; 603 while(@string_lines) { 604 print join "", @string_lines[0..($SCREEN_HEIGHT>scalar @string_lines ? (scalar @string_lines)-1 : $SCREEN_HEIGHT-1)]; 605 if(scalar @string_lines >= $SCREEN_HEIGHT) { 606 print "\n[Press ENTER to continues...]"; 607 <STDIN>; 608 print "\n"; 609 } 610 @string_lines = @string_lines[$SCREEN_HEIGHT..$#string_lines]; 611 } 612 } 613 614 sub questionChar 615 { 616 my ($question, $default, @valid) = @_; 617 my $answer; 618 do { 619 print $question, " "; 620 foreach (@valid) { 621 $_ eq $default and print "["; 622 print $_; 623 $_ eq $default and print "]"; 624 } 625 print " "; 626 $answer = <STDIN>; 627 $answer =~ s/^\s*//; 628 $answer = substr $answer, 0, 1; 629 $answer = lc $answer; 630 $answer or $answer = $default; 631 } while (not grep(/$answer/, @valid)); 632 return $answer; 633 } 634 635 sub questionString 636 { 637 my ($question, $default, $emptyOK) = @_; 638 my $answer; 639 print $question, " [", $default, "] "; 640 $answer = <STDIN>; 641 chomp $answer; 642 $answer =~ s/^\s*//; 643 $answer or $answer = $default; 644 return $answer; 645 } 646 647 __END__ 648 649 =head1 NAME 650 651 system_webwork_setup.pl - set up the WeBWorK system 652 653 =head1 SYNOPSIS 654 655 system_webwork_setup.pl [defaults-file] 656 657 =head1 DESCRIPTION 658 659 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>. 660 661 =head1 DEFAULTS 662 663 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: 664 665 =over 4 666 667 =item $no_prompts 668 669 Refrain from prompting at the beginning of the script and before making changes. Also supresses the introductory text. 670 671 =item $system_setup_mode 672 673 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. 674 675 =item $mainDir 676 677 Specify WeBWorK's main directory, which should contain the directories cgi/ scripts/ courseScripts/ and lib/. 678 679 =item $perlPath 680 681 Specify the path to the perl interpreter which should be used. This is used to set the shebang line in cgi-scripts and scripts. 682 683 =item $cgiURL 684 685 Specify the externally visible URL to the CGI directory (typically cgi/cgi-scripts/). This will be used when scripts call other scripts. 686 687 =item $htmlURL 688 689 Specify the externally visible URL to the HTML directory (typically system_html/). This will be used when scripts refer to static graphics and text. 690 691 =item $groupName 692 693 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!) 694 695 =item $update_stuff_in_courses 696 697 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. 698 699 =item $chgrp_files_and_dirs, $chmod_files_and_dirs 700 701 If true, the group and/or permissions on system files will be set according to I<$system_setup_mode>. 702 703 =item $local_preprocessor, $local_postprocessor 704 705 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. 706 707 =back 708 709 =head FILES 710 711 $HOME/system_webwork_setup.defaults 712 713 =head1 AUTHOR 714 715 Samuel Hathaway <sh002i@math.rochester.edu>
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |