| 1 | #!/usr/bin/perl |
1 | #!/usr/bin/perl |
| 2 | |
2 | |
| 3 | use strict; |
3 | use strict; |
| 4 | use warnings; |
4 | use warnings; |
|
|
5 | |
|
|
6 | my @applicationsList = qw( |
|
|
7 | mkdir |
|
|
8 | mv |
|
|
9 | mysql |
|
|
10 | tar |
|
|
11 | latex |
|
|
12 | pdflatex |
|
|
13 | dvipng |
|
|
14 | tth |
|
|
15 | giftopnm |
|
|
16 | ppmtopgm |
|
|
17 | pnmtops |
|
|
18 | pnmtopng |
|
|
19 | pngtopnm |
|
|
20 | ); |
| 5 | |
21 | |
| 6 | my @apache1ModulesList = qw( |
22 | my @apache1ModulesList = qw( |
| 7 | Apache |
23 | Apache |
| 8 | Apache::Constants |
24 | Apache::Constants |
| 9 | Apache::Cookie |
25 | Apache::Cookie |
| … | |
… | |
| 84 | push @modulesList, @apache1ModulesList; |
100 | push @modulesList, @apache1ModulesList; |
| 85 | } elsif ($apache_version eq "apache2") { |
101 | } elsif ($apache_version eq "apache2") { |
| 86 | push @modulesList, @apache2ModulesList; |
102 | push @modulesList, @apache2ModulesList; |
| 87 | } |
103 | } |
| 88 | |
104 | |
| 89 | my @applicationsList = qw( |
105 | my @PATH = split(/:/, $ENV{PATH}); |
| 90 | mkdir |
106 | check_apps(@applicationsList); |
| 91 | mv |
|
|
| 92 | mysql |
|
|
| 93 | tar |
|
|
| 94 | latex |
|
|
| 95 | pdflatex |
|
|
| 96 | dvipng |
|
|
| 97 | tth |
|
|
| 98 | giftopnm |
|
|
| 99 | ppmtopgm |
|
|
| 100 | pnmtops |
|
|
| 101 | pnmtopng |
|
|
| 102 | pngtopnm |
|
|
| 103 | ); |
|
|
| 104 | |
107 | |
| 105 | check_apps(@applicationsList); |
|
|
| 106 | check_modules(@modulesList); |
108 | check_modules(@modulesList); |
|
|
109 | |
| 107 | sub check_apps { |
110 | sub check_apps { |
| 108 | my @applicationsList = @_; |
111 | my @applicationsList = @_; |
| 109 | print "\nChecking your \$PATH for executables required by WeBWorK...\n"; |
112 | print "\nChecking your \$PATH for executables required by WeBWorK...\n"; |
| 110 | my @path = split(/:/, $ENV{PATH}); |
|
|
| 111 | print "\$PATH=", shift @path, "\n"; |
113 | print "\$PATH=", shift @PATH, "\n"; |
| 112 | print join ("\n", map(" $_", @path)), "\n\n"; |
114 | print join ("\n", map(" $_", @PATH)), "\n\n"; |
| 113 | |
115 | |
| 114 | foreach my $app (@applicationsList) { |
116 | foreach my $app (@applicationsList) { |
| 115 | my $result = `which $app`; |
117 | my $found = which($app); |
| 116 | chomp($result); |
118 | if ($found) { |
| 117 | unless ($result =~ /\s*no/) { |
|
|
| 118 | print " $app found at $result\n"; |
119 | print " $app found at $found\n"; |
| 119 | } else { |
120 | } else { |
| 120 | $result =~ s/\s*no//; |
|
|
| 121 | print "** $app not found in \$result\n"; |
121 | print "** $app not found in \$PATH\n"; |
| 122 | } |
122 | } |
| 123 | } |
123 | } |
| 124 | |
124 | } |
| 125 | print "\nLoading Perl modules required by WeBWorK...\n"; |
125 | |
| 126 | my @inc = @INC; |
126 | sub which { |
| 127 | print "\@INC=", shift @inc, "\n"; |
127 | my $app = shift; |
| 128 | print join ("\n", map(" $_", @inc)), "\n\n"; |
128 | foreach my $path (@PATH) { |
|
|
129 | return "$path/$app" if -e "$path/$app"; |
|
|
130 | } |
| 129 | } |
131 | } |
| 130 | |
132 | |
| 131 | sub check_modules { |
133 | sub check_modules { |
| 132 | my @modulesList = @_; |
134 | my @modulesList = @_; |
|
|
135 | |
|
|
136 | print "\nChecking your \@INC for modules required by WeBWorK...\n"; |
|
|
137 | my @inc = @INC; |
|
|
138 | print "\@INC=", shift @inc, "\n"; |
|
|
139 | print join ("\n", map(" $_", @inc)), "\n\n"; |
|
|
140 | |
| 133 | foreach my $module (@modulesList) { |
141 | foreach my $module (@modulesList) { |
| 134 | eval "use $module"; |
142 | eval "use $module"; |
| 135 | if ($@) { |
143 | if ($@) { |
| 136 | my $file = $module; |
144 | my $file = $module; |
| 137 | $file =~ s|::|/|g; |
145 | $file =~ s|::|/|g; |