| … | |
… | |
| 465 | # } |
465 | # } |
| 466 | # } |
466 | # } |
| 467 | # warn "fixed $num 'use lib' lines in $file\n" if $num > 1; |
467 | # warn "fixed $num 'use lib' lines in $file\n" if $num > 1; |
| 468 | # } |
468 | # } |
| 469 | |
469 | |
| 470 | # write the file |
470 | # write the file, only if there were changes |
|
|
471 | |
|
|
472 | if($num) { |
| 471 | open FILE, ">$file" || die "CAN'T WRITE $file!\n Fix the problem and run the setup script again"; |
473 | open FILE, ">$file" || die "CAN'T WRITE $file!\n Fix the problem and run the setup script again"; |
| 472 | print FILE @lines; |
474 | print FILE @lines; |
| 473 | close FILE || die "CAN'T CLOSE (writing) $file!\n Fix the problem and run the setup script again"; |
475 | close FILE || die "CAN'T CLOSE (writing) $file!\n Fix the problem and run the setup script again"; |
|
|
476 | } |
| 474 | } |
477 | } |
| 475 | |
478 | |
| 476 | print "done fixing #! and \"use\" lines.\n\n"; |
479 | print "done fixing #! and \"use\" lines.\n\n"; |
| 477 | |
480 | |
| 478 | #################### create webworkInit.pm files |
481 | #################### create webworkInit.pm files |
| 479 | # uses: $mainDir |
482 | # uses: $mainDir |
| 480 | |
483 | |
| 481 | foreach my $dir ('cgi/cgi-scripts/', 'scripts/') { |
484 | foreach my $dir ('cgi/', 'cgi/cgi-scripts/', 'scripts/', 'courseScripts/') { |
| 482 | open INIT_FILE, ">$mainDir${dir}webworkInit.pm"; |
485 | open INIT_FILE, ">$mainDir${dir}webworkInit.pm"; |
| 483 | print INIT_FILE "use lib '${mainDir}lib/';\n1;\n"; |
486 | print INIT_FILE "use lib '${mainDir}lib/';\n1;\n"; |
| 484 | close INIT_FILE; |
487 | close INIT_FILE; |
| 485 | } |
488 | } |
| 486 | |
489 | |