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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (download) (as text) (annotate)
Mon Jul 2 19:39:17 2001 UTC (11 years, 10 months ago) by sam
File size: 22799 byte(s)
modified section that writes webworkConfig.pm so that it respects the
$Global::cgiDebugMode flag.

    1 #!/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 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 #! and use lines
  411 # uses: $mainDir, $perlPath
  412 
  413 print "Fixing #! lines...\n";
  414 
  415 # fix up the course setup script and the *.pl files
  416 fixFile('../courses/demoCourse/course_webwork_setup.pl') if $update_stuff_in_courses;
  417 foreach my $dir ('cgi/cgi-scripts', 'scripts', 'courseScripts') {
  418   foreach my $file (<${dir}/*.pl>) {
  419     fixFile($file);
  420   }
  421 }
  422 
  423 sub fixFile
  424 {
  425   my ($file) = @_;
  426 
  427   # read the file
  428   open FILE, $file || die "Couldn't open $file for reading.";
  429   my @lines = <FILE>;
  430   close FILE || die "Couldn't close $file after reading.";
  431 
  432   # fix perl path
  433   $lines[0] =~ m/^#!(\S*)/;
  434   if($1 ne $perlPath) {
  435     $lines[0] =~ s/^#!\S*/#!$perlPath/;
  436     open FILE, ">$file" || die "Couldn't open $file for writing.";
  437     print FILE @lines;
  438     close FILE || die "Couldn't close $file for writing.";
  439   }
  440 }
  441 
  442 print "done fixing #! and \"use\" lines.\n\n";
  443 
  444 #################### write webworkConfig.pm file
  445 # uses: $mainDir, $cgiURL, $htmlURL
  446 
  447 print "Writing lib/webworkConfig.pm file...\n";
  448 open CONFIG_FILE, ">${mainDir}lib/webworkConfig.pm";
  449 #print CONFIG_FILE
  450 # "package Global;\n\n",
  451 # "\$cgiWebworkURL = \"${cgiURL}cgi-scripts/\";\n",
  452 # "\$htmlWebworkURL = \"$htmlURL\";\n",
  453 # "\$mainDirectory = \"$mainDir\";\n\n",
  454 # "1;";
  455 print CONFIG_FILE<<END_OF_CONFIG_FILE;
  456 package Global;
  457 
  458 ################################################################################
  459 # WeBWorK
  460 #
  461 # Copyright (c) 1995-2001 WeBWorK Team, University of Rochester
  462 # All rights reserved
  463 ################################################################################
  464 
  465 \$mainDirectory = "$mainDir";
  466 \$htmlWebworkURL = "$htmlURL";
  467 \$cgiWebworkURL = "${cgiURL}";
  468 \$cgiWebworkURL .= "cgi-scripts/" if \$cgiDebugMode;
  469 
  470 1;
  471 END_OF_CONFIG_FILE
  472 close CONFIG_FILE;
  473 print "Done writing lib/webworkConfig.pm file.\n\n";
  474 
  475 #################### write webworkInit.pm files
  476 # uses: $mainDir
  477 
  478 print "Writing webworkInit.pm files...\n";
  479 foreach my $dir ('cgi/', 'cgi/cgi-scripts/', 'scripts/', 'courseScripts/') {
  480   open INIT_FILE, ">$mainDir${dir}webworkInit.pm";
  481   print INIT_FILE
  482     "use lib '${mainDir}lib/';\n\n",
  483     "1;";
  484   close INIT_FILE;
  485 }
  486 print "Done writing webworkInit.pm files.\n\n";
  487 
  488 #################### chgrp system stuff
  489 # uses: $chgrp_files_and_dirs, $groupName, $serverGroupName
  490 
  491 if($chgrp_files_and_dirs) {
  492   print "Setting group on system files and directories...\n";
  493   # R=recursive, P=don't follow symlinks
  494   system "chgrp -PR $groupName .";
  495   system "chgrp -PR $serverGroupName logs/" unless $serverGroupName eq "SKIP";
  496   print "Done setting group.\n\n";
  497 }
  498 
  499 #################### chmod system stuff
  500 # uses: $chmod_files_and_dirs
  501 
  502 if($chmod_files_and_dirs) {
  503   print "Setting permissions on system files and directories for $system_setup_mode mode...\n";
  504   if ($system_setup_mode eq "demo") {
  505     # get some general permissions for files and directories
  506     system "find . -type d -print0 | xargs -0 chmod 0711";
  507     system "find . -type f -print0 | xargs -0 chmod 0644";
  508     # add executable privs to scripts
  509     system "find cgi scripts -type f -print0 | xargs -0 chmod 0755";
  510     # give everyone write access to logs
  511     # (we should probably just be chowning the log directory to the webserver)
  512     system "chmod 0666 logs/*";
  513     # make this script executable and safe
  514     system "chmod 0700 system_webwork_setup.pl"
  515   } else {
  516     # get some general permissions for files and directories
  517     system "find . -type d -print0 | xargs -0 chmod 0771";
  518     system "find . -type f -print0 | xargs -0 chmod 0664";
  519     # add executable privs to scripts
  520     system "find cgi scripts -type f -print0 | xargs -0 chmod 0775";
  521     # give everyone write access to logs
  522     # (we should probably just be chowning the log directory to the webserver)
  523     system "find logs -type f -print0 | xargs -0 chmod 0666";
  524     # make this script executable and safe
  525     system "chmod 0770 system_webwork_setup.pl"
  526   }
  527   print "done setting permissions.\n\n";
  528 }
  529 
  530 #################### fix up the documemtation html files
  531 # uses: $htmlURL, $cgiURL
  532 
  533 print "Fixing image, cgi-bin, and ref lines in documentation html files...\n";
  534 foreach my $dir ('system_html/helpFiles') {
  535   foreach my $file (<${dir}/*.html>) {
  536     open FILE, $file    || die "CAN'T READ $file!\n Fix the problem and run the setup script again";
  537     my @lines = <FILE>;
  538     close FILE      || die "CAN'T CLOSE $file!\n Fix the problem and run the setup script again";
  539 
  540     foreach my $line (@lines) {
  541       $line =~ s|<IMG SRC=".*?images/|<IMG SRC="${htmlURL}images/|g; # fix "images" line
  542       $line =~ s|<A HREF=".*?feedback.pl">|<A HREF="${cgiURL}feedback.pl">|g;     # fix "cgi-bin" line
  543       $line =~ s|<A HREF=".*?docs/">|<A HREF="${htmlURL}docs/">|g; # fix "Ref" line
  544     }
  545     open FILE, ">$file" || die "CAN'T WRITE $file!\n Fix the problem and run the setup script again";
  546     print FILE @lines;
  547     close FILE      || die "CAN'T CLOSE (writing) $file!\n Fix the problem and run the setup script again";
  548   }
  549 }
  550 print "done fixing documentation files.\n\n";
  551 
  552 #################### update couses stuff
  553 # uses: $update_stuff_in_courses
  554 
  555 if($update_stuff_in_courses) {
  556   print "Setting permissions for ../courses directory.\n\n";
  557   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";
  558 }
  559 
  560 #################### run local postprocessor
  561 
  562 if(defined $local_postprocessor) {
  563   print "Executing local postprocessor...\n";
  564   &$local_postprocessor;
  565   print "Done with local postprocessor.\n";
  566 }
  567 
  568 #################### finish up
  569 
  570 page($DONE_TEXT);
  571 
  572 ################################################################################
  573 
  574 sub page
  575 {
  576   my @string_lines = split /^/, shift; #/
  577   # not really optimal, but we're going to assume a constant screen height.
  578   my $SCREEN_HEIGHT = 20;
  579   while(@string_lines) {
  580     print join "", @string_lines[0..($SCREEN_HEIGHT>scalar @string_lines ? (scalar @string_lines)-1 : $SCREEN_HEIGHT-1)];
  581     if(scalar @string_lines >= $SCREEN_HEIGHT) {
  582       print "\n[Press ENTER to continues...]";
  583       <STDIN>;
  584       print "\n";
  585     }
  586       @string_lines = @string_lines[$SCREEN_HEIGHT..$#string_lines];
  587   }
  588 }
  589 
  590 sub questionChar
  591 {
  592   my ($question, $default, @valid) = @_;
  593   my $answer;
  594   do {
  595     print $question, " ";
  596     foreach (@valid) {
  597       $_ eq $default and print "[";
  598       print $_;
  599       $_ eq $default and print "]";
  600     }
  601     print " ";
  602     $answer = <STDIN>;
  603     $answer =~ s/^\s*//;
  604     $answer = substr $answer, 0, 1;
  605     $answer = lc $answer;
  606     $answer or $answer = $default;
  607   } while (not grep(/$answer/, @valid));
  608   return $answer;
  609 }
  610 
  611 sub questionString
  612 {
  613   my ($question, $default, $emptyOK) = @_;
  614   my $answer;
  615   print $question, " [", $default, "] ";
  616   $answer = <STDIN>;
  617   chomp $answer;
  618   $answer =~ s/^\s*//;
  619   $answer or $answer = $default;
  620   return $answer;
  621 }
  622 
  623 __END__
  624 
  625 =head1 NAME
  626 
  627 system_webwork_setup.pl - set up the WeBWorK system
  628 
  629 =head1 SYNOPSIS
  630 
  631 system_webwork_setup.pl [defaults-file]
  632 
  633 =head1 DESCRIPTION
  634 
  635 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>.
  636 
  637 =head1 DEFAULTS
  638 
  639 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:
  640 
  641 =over 4
  642 
  643 =item $no_prompts
  644 
  645 Refrain from prompting at the beginning of the script and before making changes. Also supresses the introductory text.
  646 
  647 =item $system_setup_mode
  648 
  649 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.
  650 
  651 =item $mainDir
  652 
  653 Specify WeBWorK's main directory, which should contain the directories cgi/ scripts/ courseScripts/ and lib/.
  654 
  655 =item $perlPath
  656 
  657 Specify the path to the perl interpreter which should be used. This is used to set the shebang line in cgi-scripts and scripts.
  658 
  659 =item $cgiURL
  660 
  661 Specify the externally visible URL to the CGI directory (typically cgi/cgi-scripts/). This will be used when scripts call other scripts.
  662 
  663 =item $htmlURL
  664 
  665 Specify the externally visible URL to the HTML directory (typically system_html/). This will be used when scripts refer to static graphics and text.
  666 
  667 =item $groupName
  668 
  669 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!)
  670 
  671 =item $update_stuff_in_courses
  672 
  673 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.
  674 
  675 =item $chgrp_files_and_dirs, $chmod_files_and_dirs
  676 
  677 If true, the group and/or permissions on system files will be set according to I<$system_setup_mode>.
  678 
  679 =item $local_preprocessor, $local_postprocessor
  680 
  681 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.
  682 
  683 =back
  684 
  685 =head FILES
  686 
  687 $HOME/system_webwork_setup.defaults
  688 
  689 =head1 AUTHOR
  690 
  691 Samuel Hathaway <sh002i@math.rochester.edu>

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9