"tunnel", "zones", "cluster-usermin", "dovecot", "syslog-ng",
"mailcap", "blue-theme", "ldap-client", "phpini", "filter",
"bacula-backup", "ldap-server", "exim", "tcpwrappers",
+ "package-updates",
);
}
@dirlist = ( "Webmin" );
push(@grid, $text{'index_mode'}, &ui_links_row(\@mlinks));
# Show all selector
-if (&show_all_option()) {
+$showall = &show_all_option();
+if ($showall == 1) {
+ # Can show all, or just virtualmin
$in{'all'} ||= 0;
foreach $a (0, 1) {
$amsg = $text{'index_all_'.$a};
}
push(@grid, $text{'index_allsel'}, &ui_links_row(\@alinks));
}
+elsif ($showall == 2) {
+ # Always showing all
+ $in{'all'} = 2;
+ }
# Show search box
push(@grid, $text{'index_search'}, &ui_textbox("search", $in{'search'}, 30)." ".
&ui_submit($text{'index_searchok'}));
print &ui_form_start("index.cgi");
-print &ui_hidden("all", &show_all_option() ? 1 : 0);
+print &ui_hidden("all", $showall ? 1 : 0);
print &ui_hidden("mode", $in{'mode'});
print &ui_grid_table(\@grid, 2),"<p>\n";
print &ui_form_end();
'checked' => $need },
"<a href='view.cgi?all=$in{'all'}&mode=$in{'mode'}&name=".
&urlize($p->{'name'})."&system=".
- &urlize($p->{'system'})."'>$p->{'name'}</a>",
+ &urlize($p->{'system'})."&search=".
+ &urlize($in{'search'})."'>$p->{'name'}</a>",
$p->{'desc'},
$msg,
$source ? ( $source ) : $anysource ? ( "") : ( ),
update_tgzsetup=Running setup script ..
update_tgzsetupdone=.. upgrade complete
update_etgzsetup=.. upgrade failed! See the error message above for the reason why
+update_rusure=Are you sure you wish to install the $1 packages listed below? This may include dependencies of packages that you selected.
+update_oldver=Current version
+update_newver=New version
+update_confirm=Install Now
+update_none=None
sched_title=Scheduled Update
sched_yes=Scheduled checking for updates is now active.
# update system.
#
# XXX cron job to collect .. actually use webmin module collector
-# XXX confirmation form, showing all dependencies
+# XXX re-check after package update
# XXX test automatic notification
+# XXX test on debian
BEGIN { push(@INC, ".."); };
eval "use WebminCore;";
return @rv;
}
+# list_package_operations(package, system)
+# Given a package, returns a list of all dependencies that will be installed
+sub list_package_operations
+{
+my ($name, $system) = @_;
+if (defined(&software::update_system_operations)) {
+ my @rv = &software::update_system_operations($name);
+ foreach my $p (@rv) {
+ $p->{'system'} = $system;
+ }
+ return @rv;
+ }
+return ( );
+}
+
# list_possible_updates([nocache])
# Returns a list of updates that are available. Each element in the array
# is a hash ref containing a name, version, description and severity flag.
return undef;
}
-# Returns 1 if an option should be shown to list all packages. Only true for
-# YUM and APT at the moment
+# Returns 1 if an option should be shown to list all packages, 2 if all
+# packages is the only option, or 0 if only virtualmin.
sub show_all_option
{
-return $software::update_system eq 'apt' || $software::update_system eq 'yum';
+return !&foreign_check("virtual-server") ? 2 :
+ $software::update_system eq 'apt' ||
+ $software::update_system eq 'yum' ? 1 : 0;
}
sub flush_package_caches
@pkgs || &error($text{'update_enone'});
&ui_print_unbuffered_header(undef, $text{'update_title'}, "");
- foreach my $ps (@pkgs) {
- ($p, $s) = split(/\//, $ps);
- print &text('update_pkg', "<tt>$p</tt>"),"<br>\n";
- print "<ul>\n";
- push(@got, &package_install($p, $s, $in{'all'}));
- print "</ul><br>\n";
+ # Work out what will be done, if possible
+ @ops = ( );
+ if (!$in{'confirm'}) {
+ foreach my $ps (@pkgs) {
+ ($p, $s) = split(/\//, $ps);
+ push(@ops, &list_package_operations($p, $s));
+ }
}
- if (@got) {
- print &text('update_ok', scalar(@got)),"<p>\n";
+
+ if (@ops) {
+ # Ask first
+ print &ui_form_start("update.cgi", "post");
+ print &ui_hidden("all", $in{'all'});
+ print &ui_hidden("mode", $in{'mode'});
+ print &ui_hidden("search", $in{'search'});
+ foreach $ps (@pkgs) {
+ print &ui_hidden("u", $ps);
+ }
+ print &text('update_rusure', scalar(@ops)),"<p>\n";
+ print &ui_form_end([ [ "confirm", $text{'update_confirm'} ] ]);
+
+ # Show table of all depends
+ @current = $in{'all'} ? &list_all_current(1)
+ : &list_current(1);
+ print &ui_columns_start([ $text{'index_name'},
+ $text{'update_oldver'},
+ $text{'update_newver'},
+ $text{'index_desc'},
+ ], 100);
+ foreach $p (@ops) {
+ ($c) = grep { $_->{'name'} eq $p->{'name'} &&
+ $_->{'system'} eq $p->{'system'} } @current;
+ if (!$c && !@avail) {
+ # Only get available if needed
+ @avail = &list_available(0, $in{'all'});
+ }
+ ($a) = grep { $_->{'name'} eq $p->{'name'} &&
+ $_->{'system'} eq $p->{'system'} } @avail;
+ print &ui_columns_row([
+ $p->{'name'},
+ $c ? $c->{'version'}
+ : "<i>$text{'update_none'}</i>",
+ $p->{'version'},
+ $c ? $c->{'desc'} :
+ $a ? $a->{'desc'} : '',
+ ]);
+ }
+ print &ui_columns_end();
}
else {
- print $text{'update_failed'},"<p>\n";
- }
-
- # Refresh collected package info
- if (&foreign_check("virtual-server") && @got) {
- &foreign_require("virtual-server", "virtual-server-lib.pl");
- if (defined(&virtual_server::refresh_possible_packages)) {
- &virtual_server::refresh_possible_packages(\@got);
+ # Do it
+ foreach my $ps (@pkgs) {
+ ($p, $s) = split(/\//, $ps);
+ print &text('update_pkg', "<tt>$p</tt>"),"<br>\n";
+ print "<ul>\n";
+ push(@got, &package_install($p, $s, $in{'all'}));
+ print "</ul><br>\n";
+ }
+ if (@got) {
+ print &text('update_ok', scalar(@got)),"<p>\n";
+ }
+ else {
+ print $text{'update_failed'},"<p>\n";
}
+
+ # Refresh collected package info
+ # XXX call webmin
+
+ &webmin_log("update", "packages", scalar(@got),
+ { 'got' => \@got });
}
- &webmin_log("update", "packages", scalar(@got),
- { 'got' => \@got });
&ui_print_footer($redir, $text{'index_return'});
}
}
print &ui_form_end(\@buts);
-&ui_print_footer("index.cgi?all=$in{'all'}&mode=$in{'mode'}",
+&ui_print_footer("index.cgi?all=$in{'all'}&mode=$in{'mode'}&search=".
+ &urlize($in{'search'}),
$text{'index_return'});