3 # Find and install updated modules, and email out the result
6 require './webmin-lib.pl';
9 @urls = $config{'upsource'} ? split(/\t+/, $config{'upsource'})
11 foreach $url (@urls) {
12 # Get updates from this URL, and filter to those for this system
13 $checksig = $config{'upchecksig'} ? 2 : $url eq $update_url ? 2 : 1;
14 ($updates, $host, $port, $page, $ssl) =
15 &fetch_updates($url, $config{'upuser'}, $config{'uppass'},
17 $updates = &filter_updates($updates, undef, $config{'upthird'},
18 $config{'upmissing'});
20 # Go through the results
21 foreach $u (@$updates) {
22 # Get module or theme's details
23 my %minfo = &get_module_info($u->[0]);
24 my %tinfo = &get_theme_info($u->[0]);
25 my %info = %minfo ? %minfo : %tinfo;
27 if ($config{'upshow'}) {
28 # Just tell the user what would be done
29 $rv .= &text('update_mshow', $u->[0], $u->[1])."\n".
30 ($info{'longdesc'} ? "$text{'update_fixes'} : " : "").
34 # Actually do the update ..
35 my (@mdescs, @mdirs, @msizes);
36 $rv .= &text('update_mok', $u->[0], $u->[1])."\n".
37 ($info{'longdesc'} ? "$text{'update_fixes'} : " : "").
39 ($mhost, $mport, $mpage, $mssl) =
40 &parse_http_url($u->[2], $host, $port, $page, $ssl);
41 ($mfile = $mpage) =~ s/^(.*)\///;
42 $mtemp = &transname($mfile);
43 &http_download($mhost, $mport, $mpage, $mtemp, \$error,
45 $config{'upuser'}, $config{'uppass'});
51 $irv = &check_update_signature(
52 $mhost, $mport, $mpage,
53 $mssl, $config{'upuser'}, $config{'uppass'},
55 $irv ||= &install_webmin_module($mtemp, 1, 0,
59 $rv .= &text('update_failed', $irv)."\n\n";
62 $rv .= &text('update_mdesc', $irv->[0]->[0],
63 $irv->[2]->[0])."\n\n";
70 # Check if a new version of webmin itself is available
71 $version = &get_latest_webmin_version();
72 if ($version > &get_webmin_version()) {
73 $rv .= &text('update_version', $version)."\n";
76 # Send off a results email
77 if ($config{'upemail'} && $rv && &foreign_check("mailboxes")) {
78 # Construct and send the email
79 &foreign_require("mailboxes", "mailboxes-lib.pl");
81 my $type = $gconfig{'real_os_type'} || $gconfig{'os_type'};
82 my $version = $gconfig{'real_os_version'} || $gconfig{'os_version'};
83 my $myhost = &get_system_hostname();
84 $data .= "$myhost ($type $version)\n\n";
85 $data .= &text('update_rv', "http://$host:$port$page")."\n\n";
87 &mailboxes::send_text_mail(&mailboxes::get_from_address(),
90 $text{'update_subject'},