Fix to pass params separately

This commit is contained in:
Ilia Ross
2023-12-30 22:25:08 +02:00
parent f82def9a9b
commit 66e2f1e1e3
3 changed files with 18 additions and 14 deletions

View File

@@ -294,12 +294,12 @@ if (!scalar(@updates_available_cache)) {
return @updates_available_cache;
}
# package_install(package-name, [system], [new-install])
# package_install(package-name, [system], [new-install], [flags])
# Install some package, either from an update system or from Webmin. Returns
# a list of updated package names.
sub package_install
{
my ($name, $system, $install) = @_;
my ($name, $system, $install, $flags) = @_;
$system ||= $software::update_system;
my @rv;
my $pkg;
@@ -342,7 +342,7 @@ if (defined(&software::update_system_install)) {
$name .= " apache2-mpm-prefork";
}
}
@rv = &software::update_system_install($name, undef, 1);
@rv = &software::update_system_install($name, undef, 1, $flags);
}
else {
# Another update system exists!! Use it..
@@ -352,7 +352,7 @@ if (defined(&software::update_system_install)) {
if (!$done_rhn_text++) {
%text = ( %text, %software::text );
}
@rv = &update_system_install($name, undef, 1);
@rv = &update_system_install($name, undef, 1, $flags);
}
&reset_environment();
}
@@ -364,12 +364,12 @@ unlink($current_cache_file);
return @rv;
}
# package_install_multiple(&package-names, system, [new-install])
# package_install_multiple(&package-names, system, [new-install], [flags])
# Install multiple packages, either from an update system or from Webmin.
# Returns a list of updated package names.
sub package_install_multiple
{
my ($names, $system, $install) = @_;
my ($names, $system, $install, $flags) = @_;
$system ||= $software::update_system;
my @rv;
my $pkg;
@@ -380,7 +380,7 @@ if (defined(&software::update_system_install)) {
if ($software::update_system eq $system) {
# Can use the default system
@rv = &software::update_system_install(
join(" ", @$names), undef, 1);
join(" ", @$names), undef, 1, $flags);
}
else {
# Another update system exists!! Use it..
@@ -390,7 +390,7 @@ if (defined(&software::update_system_install)) {
if (!$done_rhn_text++) {
%text = ( %text, %software::text );
}
@rv = &update_system_install(join(" ", @$names), undef, 1);
@rv = &update_system_install(join(" ", @$names), undef, 1, $flags);
}
&reset_environment();
}

View File

@@ -112,7 +112,6 @@ else {
# Do it
$msg = $in{'mode'} eq 'new' ? 'update_pkg2' : 'update_pkg';
$flags = $in{'flags'};
&start_update_progress([ map { (split(/\//, $_))[0] } @pkgs ]);
if ($config{'update_multiple'} && @pkgs > 1) {
# Update all packages at once
@@ -125,9 +124,8 @@ else {
print &text($msg, "<tt>".&html_escape(join(" ", @pkgnames))."</tt>"),
"<br>\n";
print "<ul data-package-updates='1'>\n";
push(@pkgnames, $flags) if ($flags);
@got = &package_install_multiple(
\@pkgnames, $pkgsystem, $in{'mode'} eq 'new');
\@pkgnames, $pkgsystem, $in{'mode'} eq 'new', $in{'flags'});
print "</ul><br>\n";
}
else {
@@ -137,9 +135,8 @@ else {
next if ($donedep{$p});
print &text($msg, "<tt>@{[&html_escape($p)]}</tt>"),"<br>\n";
print "<ul data-package-updates='2'>\n";
$p = "$p $flags" if ($flags);
@pgot = &package_install(
$p, $s, $in{'mode'} eq 'new');
$p, $s, $in{'mode'} eq 'new', $in{'flags'});
foreach $g (@pgot) {
$donedep{$g}++;
}

View File

@@ -19,12 +19,17 @@ sub list_update_system_commands
return ($yum_command);
}
# update_system_install([packages], [&in])
# update_system_install([packages], [&in], [no-force], [flags])
# Install some package with yum
sub update_system_install
{
local $update = $_[0] || $in{'update'};
local $in = $_[1];
local $force = !$_[2];
local $flags = $_[3];
local $qflags;
$qflags = &trim(join(" ", map { quotemeta($_) } split(/ /, $flags)))
if ($flags);
$update =~ s/\.\*/\*/g;
local $enable;
if ($in->{'enablerepo'}) {
@@ -57,7 +62,9 @@ else {
# Work out the command to run, which may enable some repos
my $uicmd = "$yum_command $enable -y $cmd ".join(" ", @names);
$uicmd .= " $flags" if ($flags);
my $fullcmd = "$yum_command $enable -y $cmd $update";
$fullcmd .= " $qflags" if ($flags);
foreach my $u (@updates) {
my $repo = &update_system_repo($u);
if ($repo) {