2 # Update selected packages
4 require './package-updates-lib.pl';
6 $redir = "index.cgi?mode=".&urlize($in{'mode'}).
7 "&search=".&urlize($in{'search'});
10 &ui_print_unbuffered_header(undef, $text{'refresh_title'}, "");
13 print $text{'refresh_clearing'},"<br>\n";
14 &flush_package_caches();
15 &clear_repository_cache();
16 print $text{'refresh_done'},"<p>\n";
19 print $text{'refresh_available'},"<br>\n";
20 @avail = &list_possible_updates();
21 print &text('refresh_done3', scalar(@avail)),"<p>\n";
23 &webmin_log("refresh");
24 &ui_print_footer($redir, $text{'index_return'});
27 # Upgrade some packages
28 my @pkgs = split(/\0/, $in{'u'});
29 @pkgs || &error($text{'update_enone'});
30 &ui_print_unbuffered_header(undef, $text{'update_title'}, "");
32 # Work out what will be done, if possible
34 if (!$in{'confirm'}) {
35 print $text{'update_ops'},"<p>\n";
37 foreach my $ps (@pkgs) {
38 ($p, $s) = split(/\//, $ps);
41 @ops = &list_package_operations(join(" ", @pkgnames), $s);
46 print &ui_form_start("update.cgi", "post");
47 print &ui_hidden("mode", $in{'mode'});
48 print &ui_hidden("search", $in{'search'});
50 print &ui_hidden("u", $ps);
52 print &text('update_rusure', scalar(@ops)),"<p>\n";
53 print &ui_form_end([ [ "confirm", $text{'update_confirm'} ] ]);
55 # Show table of all depends
56 @current = &list_current(1);
57 print &ui_columns_start([ $text{'index_name'},
58 $text{'update_oldver'},
59 $text{'update_newver'},
63 ($c) = grep { $_->{'name'} eq $p->{'name'} &&
64 $_->{'system'} eq $p->{'system'} } @current;
66 # Only get available if needed
67 @avail = &list_available(0);
69 ($a) = grep { $_->{'name'} eq $p->{'name'} &&
70 $_->{'system'} eq $p->{'system'} } @avail;
71 print &ui_columns_row([
74 : "<i>$text{'update_none'}</i>",
77 $a ? $a->{'desc'} : '',
80 print &ui_columns_end();
84 $msg = $in{'mode'} eq 'new' ? 'update_pkg2' : 'update_pkg';
85 foreach my $ps (@pkgs) {
86 ($p, $s) = split(/\//, $ps);
87 next if ($donedep{$p});
88 print &text($msg, "<tt>$p</tt>"),"<br>\n";
90 @pgot = &package_install($p, $s);
98 print &text('update_ok', scalar(@got)),"<p>\n";
101 print $text{'update_failed'},"<p>\n";
104 # Refresh collected package info
105 if (&foreign_check("system-status")) {
106 &foreign_require("system-status");
107 &system_status::refresh_possible_packages(\@got);
110 &webmin_log("update", "packages", scalar(@got),
114 &ui_print_footer($redir, $text{'index_return'});