Initial checkin of Webmin
[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 do './web-lib.pl';
7 &init_config();
8 &foreign_require("webmin", "webmin-lib.pl");
9 @themes = &webmin::list_themes();
10
11 if (@ARGV > 0) {
12         # Running for specified modules
13         foreach $a (@ARGV) {
14                 local %minfo = &get_module_info($a);
15                 if (!%minfo) {
16                         # Try for a theme
17                         ($tinfo) = grep { $_->{'dir'} eq $a } @themes;
18                         if ($tinfo) {
19                                 push(@mods, $tinfo);
20                                 }
21                         }
22                 else {
23                         push(@mods, \%minfo);
24                         }
25                 }
26         }
27 else {
28         # Running on all modules and themes
29         @mods = ( &get_all_module_infos(), @themes );
30         }
31
32 foreach $m (@mods) {
33         $mdir = &module_root_directory($m->{'dir'});
34         if (&check_os_support($m) &&
35             -r "$mdir/postinstall.pl") {
36                 # Call this module's postinstall function
37                 eval {
38                         &foreign_require($m->{'dir'}, "postinstall.pl");
39                         &foreign_call($m->{'dir'}, "module_install");
40                         };
41                 }
42         }
43