[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 47 Revision 48
15 15
16# define built-in defaults 16# define built-in defaults
17my $DEFAULT_PERL_PATH = '/usr/bin/perl'; 17my $DEFAULT_PERL_PATH = '/usr/bin/perl';
18my $DEFAULT_CGI_URL = '/cgi-bin/webwork/system/'; 18my $DEFAULT_CGI_URL = '/cgi-bin/webwork/system/';
19my $DEFAULT_HTML_URL = '/webwork_system_html'; 19my $DEFAULT_HTML_URL = '/webwork_system_html';
20my $DEFAULT_SERVER_GROUP = 'webwork';
20 21
21# define code strings 22# define code strings
22my $CGI_DEBUG_TAG = 'WeBWorKCGIDebugURL'; 23my $CGI_DEBUG_TAG = 'WeBWorKCGIDebugURL';
23my $CGI_NODEBUG_TAG = 'WeBWorKCGINoDebugURL'; 24my $CGI_NODEBUG_TAG = 'WeBWorKCGINoDebugURL';
24my $LIB_INIT_LINE_TAG = 'WeBWorKInitLine'; 25my $LIB_INIT_LINE_TAG = 'WeBWorKInitLine';
29$mainDir = undef; 30$mainDir = undef;
30$perlPath = undef; 31$perlPath = undef;
31$cgiURL = undef; 32$cgiURL = undef;
32$htmlURL = undef; 33$htmlURL = undef;
33$groupName = undef; 34$groupName = undef;
35$serverGroupName = undef;
34$update_stuff_in_courses = undef; 36$update_stuff_in_courses = undef;
35$chgrp_files_and_dirs = undef; 37$chgrp_files_and_dirs = undef;
36$chmod_files_and_dirs = undef; 38$chmod_files_and_dirs = undef;
37$local_preprocessor = undef; 39$local_preprocessor = undef;
38$local_postprocessor = undef; 40$local_postprocessor = undef;
141my $GROUP_TEXT = q{ 143my $GROUP_TEXT = q{
142 144
143WeBWorK needs to know what the admin group is. This group should have been 145WeBWorK needs to know what the admin group is. This group should have been
144set up by your system administrator and must contain at least your user ID. 146set up by your system administrator and must contain at least your user ID.
145All files and directories created will have this as their group. 147All files and directories created will have this as their group.
148
149};
150
151my $SERVER_GROUP_TEXT = q{
152
153In order to give the webserver access to the logs directory, WeBWorK
154must know the group under which the web server will run. If you are
155running this script as a user other than root, you will need to be a
156member of the server's group in order to set the group on the logs
157directory. If you are not running as root and you are not a member of
158the server's group, you can skip this step and change the group manually
159later. To skip this step, type SKIP below.
146 160
147}; 161};
148 162
149my $COURSE_PERMS_TEXT = q{ 163my $COURSE_PERMS_TEXT = q{
150 164
300 } 314 }
301 } 315 }
302 } 316 }
303} 317}
304print "Admin group is: $groupName\n"; 318print "Admin group is: $groupName\n";
319
320#################### server group
321
322unless(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}
345print "Server group is: $serverGroupName\n";
305 346
306#################### chmod courses directory 347#################### chmod courses directory
307 348
308unless(defined $update_stuff_in_courses) { 349unless(defined $update_stuff_in_courses) {
309 page($COURSE_PERMS_TEXT); 350 page($COURSE_PERMS_TEXT);
465 close INIT_FILE; 506 close INIT_FILE;
466} 507}
467print "Done writing webworkInit.pm files.\n\n"; 508print "Done writing webworkInit.pm files.\n\n";
468 509
469#################### chgrp system stuff 510#################### chgrp system stuff
470# uses: $chgrp_files_and_dirs, $groupName 511# uses: $chgrp_files_and_dirs, $groupName, $serverGroupName
471 512
472if($chgrp_files_and_dirs) { 513if($chgrp_files_and_dirs) {
473 print "Setting group on system files and directories...\n"; 514 print "Setting group on system files and directories...\n";
474 # R=recursive, P=don't follow symlinks 515 # R=recursive, P=don't follow symlinks
475 system "chgrp -PR $groupName ."; 516 system "chgrp -PR $groupName .";
517 system "chgrp -PR $serverGroupName logs/" unless $serverGroupName eq "SKIP";
476 print "Done setting group.\n\n"; 518 print "Done setting group.\n\n";
477} 519}
478 520
479#################### chmod system stuff 521#################### chmod system stuff
480# uses: $chmod_files_and_dirs 522# uses: $chmod_files_and_dirs

Legend:
Removed from v.47  
changed lines
  Added in v.48

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9