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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 173 Revision 174
12#################### initialization 12#################### initialization
13 13
14require 5.000; 14require 5.000;
15use Cwd; 15use Cwd;
16use File::Copy; 16use File::Copy;
17use File::Find;
18use FindBin;
19
20# get the base (webwork/) directory
21my $BASE_DIR = $FindBin::Bin;
22 17
23# define built-in defaults 18# define built-in defaults
24my $DEFAULT_PERL_PATH = '/usr/bin/perl'; 19my $DEFAULT_PERL_PATH = '/usr/bin/perl';
25my $DEFAULT_CGI_URL = '/cgi-bin/webwork/system/'; 20my $DEFAULT_CGI_URL = '/cgi-bin/webwork/system/';
26my $DEFAULT_HTML_URL = '/webwork_system_html/'; 21my $DEFAULT_HTML_URL = '/webwork_system_html/';
68initialization files, set groups and permissions for files and directories, 63initialization files, set groups and permissions for files and directories,
69and modify files. A "demo" or "working" version of the system can be setup. 64and modify files. A "demo" or "working" version of the system can be setup.
70 65
71You will need the following information: 66You will need the following information:
72 67
731) The path to perl on your system. Usually this is something like 681) The location of your WeBWorK system directory.
74/usr/bin/perl or /usr/local/bin/perl 69 Example: /usr/local/webwork/system/
70 Example: /var/www/webwork/system/
75 71
762) The group (e.g. wwadmin) containing the user names of anyone who has the 722) The path to perl on your system.
77authority to modify the webwork system files. Who ever runs this script must 73 Example: /usr/bin/perl
78be a member of this group. This should be set up by your system 74 Example: /usr/local/bin/perl
79administrator before running this script. (Note: This is not required for a
80demo version.)
81 75
823) The cgi WeBWorK URL. Usually this is something like 763) The group containing the users who have the authority to modify the
83http://webwork.math.rochester.edu/cgi-bin/webwork/system. In the above 77 webwork system files. Who ever runs this script must be a member of
84cases, you can just enter /cgi-bin/webwork/system which is prefered but 78 this group. (Note: This is not required for the demo mode.)
85if you do, don't forget the initial / . 79 Example: wwadmin
86 80
874) The html WeBWorK URL. Usually this is something like 814) The URL to the WeBWorK CGI scripts.
88http://webwork.math.rochester.edu/webwork_system_html. Again in this 82 Example: /cgi-bin/webwork/system/ (preferred)
89case /webwork_system_html is prefered. 83
845) The URL to the static system_html files.
85 Example: /webwork_system_html/
90 86
91}; 87};
92 88
93my $MODE_TEXT = q{ 89my $MODE_TEXT = q{
94 90
123 119
124my $CGI_URL_TEXT = q{ 120my $CGI_URL_TEXT = q{
125 121
126In order for generated HTML to be able to invoke CGI scripts, WeBWorK 122In order for generated HTML to be able to invoke CGI scripts, WeBWorK
127needs to know the URL which points to the main WeBWorK system cgi 123needs to know the URL which points to the main WeBWorK system cgi
128subdirectory. For example,
129http://webwork.math.rochester.edu.edu/cgi-bin/webwork/system might be a
130valid CGI URL. If both static HTML and CGIs reside on the same host 124subdirectory. If both static HTML and CGIs reside on the same host
131(which is true in most cases), you can omit the 125(which is true in most cases), you can omit the http://hostname section
132http://webwork.math.rochester.edu section of the URL. Make sure to 126of the URL, but make sure the leading slash is present.
133include a leading slash in this case.
134 127
135}; 128};
136 129
137my $HTML_URL_TEXT = q{ 130my $HTML_URL_TEXT = q{
138 131
139WeBWorK also needs to know the URL of the main HTML directory, the 132WeBWorK also needs to know the URL of the main HTML directory, the
140system html subdirectory. For example, 133system_html subdirectory. If both static HTML and CGIs reside on the
141http://webwork.math.rochester.edu/webwork_system_html or 134same host (which is true in most cases), you can omit the
142/webwork_system_html. 135http://hostname section of the URL, but make sure the leading slash is
136present.
143 137
144}; 138};
145 139
146my $GROUP_TEXT = q{ 140my $GROUP_TEXT = q{
147 141
228 222
229#################### main directory 223#################### main directory
230 224
231unless(defined $mainDir) { 225unless(defined $mainDir) {
232 page($MAIN_DIR_TEXT); 226 page($MAIN_DIR_TEXT);
233 $mainDir = questionString("Where is the WeBWorK system directory?", "$BASE_DIR/system/"); 227 $mainDir = questionString("Where is the WeBWorK system directory?", cwd());
234 $mainDir .= '/' unless $mainDir =~ m|/$|; # ensure trailing slash 228 $mainDir .= '/' unless $mainDir =~ m|/$|; # ensure trailing slash
235} 229}
236print "We'll use $mainDir as WeBWorK's system directory.\n"; 230print "We'll use $mainDir as WeBWorK's system directory.\n";
237 231
238#################### perl path 232#################### perl path
415# All rights reserved 409# All rights reserved
416################################################################################ 410################################################################################
417 411
418\$mainDirectory = "$mainDir"; 412\$mainDirectory = "$mainDir";
419\$htmlWebworkURL = "$htmlURL"; 413\$htmlWebworkURL = "$htmlURL";
420\$cgiWebworkURL = "${cgiURL}"; 414\$cgiWebworkURL = "$cgiURL";
421\$cgiWebworkURL .= "cgi-scripts/" unless \$cgiDebugMode; 415\$cgiWebworkURL .= "cgi-scripts/" unless \$cgiDebugMode;
422 416
4231; 4171;
424END_OF_CONFIG_FILE 418END_OF_CONFIG_FILE
425close CONFIG_FILE; 419close CONFIG_FILE;
451# uses: $chgrp_files_and_dirs, $groupName 445# uses: $chgrp_files_and_dirs, $groupName
452 446
453if($chgrp_files_and_dirs) { 447if($chgrp_files_and_dirs) {
454 print "Setting group on system files and directories...\n"; 448 print "Setting group on system files and directories...\n";
455 system "chgrp -R $groupName $mainDir"; 449 system "chgrp -R $groupName $mainDir";
456 system "chgrp -R $groupName $BASE_DIR/system_html"; 450 system "chgrp -R $groupName $mainDir/../system_html";
457 print "Done setting group.\n\n"; 451 print "Done setting group.\n\n";
458} 452}
459 453
460#################### chmod system stuff 454#################### chmod system stuff
461# uses: $chmod_files_and_dirs 455# uses: $chmod_files_and_dirs
462 456
463if($chmod_files_and_dirs) { 457if($chmod_files_and_dirs) {
464 print "Setting permissions on system files and directories for $system_setup_mode mode...\n"; 458 print "Setting permissions on system files and directories for $system_setup_mode mode...\n";
465 if ($system_setup_mode eq "demo") { 459 if ($system_setup_mode eq "demo") {
466 # get some general permissions for files and directories 460 # get some general permissions for files and directories
467 system "find $mainDir $BASE_DIR/system_html -type d -print0 | xargs -0 chmod 0755"; 461 system "find $mainDir $mainDir/../system_html -type d -print0 | xargs -0 chmod 0755";
468 system "find $mainDir $BASE_DIR/system_html -type f -print0 | xargs -0 chmod 0644"; 462 system "find $mainDir $mainDir/../system_html -type f -print0 | xargs -0 chmod 0644";
469 # add executable privs to scripts 463 # add executable privs to scripts
470 system "find ${mainDir}cgi ${mainDir}scripts -type f -print0 | xargs -0 chmod 0755"; 464 system "find ${mainDir}cgi ${mainDir}scripts -type f -print0 | xargs -0 chmod 0755";
471 } else { 465 } else {
472 # get some general permissions for files and directories 466 # get some general permissions for files and directories
473 system "find $mainDir $BASE_DIR/system_html -type d -print0 | xargs -0 chmod 0775"; 467 system "find $mainDir $mainDir/../system_html -type d -print0 | xargs -0 chmod 0775";
474 system "find $mainDir $BASE_DIR/system_html -type f -print0 | xargs -0 chmod 0664"; 468 system "find $mainDir $mainDir/../system_html -type f -print0 | xargs -0 chmod 0664";
475 # add executable privs to scripts 469 # add executable privs to scripts
476 system "find ${mainDir}cgi ${mainDir}scripts -type f -print0 | xargs -0 chmod 0775"; 470 system "find ${mainDir}cgi ${mainDir}scripts -type f -print0 | xargs -0 chmod 0775";
477 } 471 }
478 print "done setting permissions.\n\n"; 472 print "done setting permissions.\n\n";
479} 473}
481#################### update couses stuff 475#################### update couses stuff
482# uses: $update_stuff_in_courses 476# uses: $update_stuff_in_courses
483 477
484if($update_stuff_in_courses) { 478if($update_stuff_in_courses) {
485 print "Setting permissions for ../courses directory.\n\n"; 479 print "Setting permissions for ../courses directory.\n\n";
486 chmod(0755, "$BASE_DIR/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"; 480 chmod(0755, "$mainDir/../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";
487} 481}
488 482
489#################### run local postprocessor 483#################### run local postprocessor
490 484
491if(defined $local_postprocessor) { 485if(defined $local_postprocessor) {

Legend:
Removed from v.173  
changed lines
  Added in v.174

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9