Handle hostnames with upper-case letters
[webmin.git] / run-postinstalls.pl
1 #!/usr/local/bin/perl
2 # run-postinstalls.pl
3 # Run all the postinstall.pl scripts in module and theme directories
4
5 $no_acl_check++;
6 use WebminCore;
7 &init_config();
8 @themes = &list_themes();
9
10 if (@ARGV > 0) {
11         # Running for specified modules
12         foreach $a (@ARGV) {
13                 local %minfo = &get_module_info($a);
14                 if (!%minfo) {
15                         # Try for a theme
16                         ($tinfo) = grep { $_->{'dir'} eq $a } @themes;
17                         if ($tinfo) {
18                                 push(@mods, $tinfo);
19                                 }
20                         }
21                 else {
22                         push(@mods, \%minfo);
23                         }
24                 }
25         }
26 else {
27         # Running on all modules and themes
28         @mods = ( &get_all_module_infos(), @themes );
29         }
30
31 foreach $m (@mods) {
32         $mdir = &module_root_directory($m->{'dir'});
33         if (&check_os_support($m) &&
34             -r "$mdir/postinstall.pl") {
35                 # Call this module's postinstall function
36                 eval {
37                         $main::error_must_die = 1;
38                         &foreign_require($m->{'dir'}, "postinstall.pl");
39                         &foreign_call($m->{'dir'}, "module_install");
40                         };
41                 if ($@) {
42                         print STDERR "$m->{'dir'}/postinstall.pl failed : $@\n";
43                         }
44                 }
45         }
46