[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 24 - (download) (as text) (annotate)
Tue Jun 19 16:04:33 2001 UTC (18 years, 8 months ago) by sam
File size: 21845 byte(s)
added POD
script now works when invoked via perl (axed "use strict" and "our" vars)
fixed bug in pager function

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

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9