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