Update multiple packages at the same time https://github.com/webmin/webmin/issues/286

This commit is contained in:
Jamie Cameron
2016-03-20 11:09:36 -07:00
parent 124d182bf6
commit 4912384cd7
5 changed files with 32 additions and 10 deletions

View File

@@ -2,3 +2,5 @@
First version of this module.
---- Changes since 1.500 ----
Debian backport versions are no longer falsely suggested for upgrading, if the apt-show-versions command is installed.
---- Changes since 1.790 ----
When updating multiple packages, they are done in a single YUM or APT operation if possible.

View File

@@ -1 +1,2 @@
cache_time=6
update_multiple=1

View File

@@ -1 +1,2 @@
cache_time=Hours to cache updated and available packages for,3,Don't cache
update_multiple=Update multiple packages,1,1-All at once,0-One by one

View File

@@ -85,18 +85,36 @@ else {
# Do it
$msg = $in{'mode'} eq 'new' ? 'update_pkg2' : 'update_pkg';
foreach my $ps (@pkgs) {
($p, $s) = split(/\//, $ps);
next if ($donedep{$p});
print &text($msg, "<tt>$p</tt>"),"<br>\n";
print "<ul>\n";
@pgot = &package_install($p, $s);
foreach $g (@pgot) {
$donedep{$g}++;
if ($config{'update_multiple'}) {
# Update all packages at once
@pkgnames = ( );
foreach my $ps (@pkgs) {
($p, $s) = split(/\//, $ps);
push(@pkgnames, $p);
$pkgsystem ||= $s;
}
push(@got, @pgot);
print &text($msg, "<tt>".join(" ", @pkgnames)."</tt>"),
"<br>\n";
print "<ul>\n";
@got = &package_install_multiple(\@pkgnames,
$pkgsystem);
print "</ul><br>\n";
}
else {
# Do them one by one in a loop
foreach my $ps (@pkgs) {
($p, $s) = split(/\//, $ps);
next if ($donedep{$p});
print &text($msg, "<tt>$p</tt>"),"<br>\n";
print "<ul>\n";
@pgot = &package_install($p, $s);
foreach $g (@pgot) {
$donedep{$g}++;
}
push(@got, @pgot);
print "</ul><br>\n";
}
}
if (@got) {
print &text('update_ok', scalar(@got)),"<p>\n";
}

View File

@@ -18,7 +18,7 @@ sub list_update_system_commands
return ($yum_command);
}
# update_system_install([package], [&in])
# update_system_install([packages], [&in])
# Install some package with yum
sub update_system_install
{