[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 94 - (download) (as text) (annotate)
Tue Aug 7 16:17:14 2001 UTC (18 years, 4 months ago) by sam
File size: 22735 byte(s)
Disabled documentation file mangling -- the documentation files no longer
need to me mangled!

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

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9