Skip to content

Commit

Permalink
Merge pull request #559 from cpanel/RE-980
Browse files Browse the repository at this point in the history
Prefer using apt-get over apt in Elevate::PkgMgr
  • Loading branch information
toddr authored Nov 25, 2024
2 parents 3e6d355 + 1389f1a commit f2db87d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions elevate-cpanel
Original file line number Diff line number Diff line change
Expand Up @@ -7416,7 +7416,6 @@ deb https://wp-toolkit.plesk.com/cPanel/Ubuntu-22.04-x86_64/latest/thirdparty/ .
-o Dpkg::Options::=--force-confold
};

our $apt = '/usr/bin/apt';
our $apt_get = '/usr/bin/apt-get';
our $apt_mark = '/usr/bin/apt-mark';
our $dpkg = '/usr/bin/dpkg';
Expand Down Expand Up @@ -7538,10 +7537,11 @@ deb https://wp-toolkit.plesk.com/cPanel/Ubuntu-22.04-x86_64/latest/thirdparty/ .

my @apt_args = (
'-y',
'--with-new-pkgs',
APT_NON_INTERACTIVE_ARGS,
);

$self->ssystem_and_die( $apt, @apt_args, 'upgrade' );
$self->ssystem_and_die( $apt_get, @apt_args, 'upgrade' );

return;
}
Expand All @@ -7551,13 +7551,13 @@ deb https://wp-toolkit.plesk.com/cPanel/Ubuntu-22.04-x86_64/latest/thirdparty/ .
}

sub update_allow_erasing ( $self, @additional_args ) {
$self->ssystem_and_die( $apt, '-y', 'autoremove', '--purge' );
$self->ssystem_and_die( $apt_get, '-y', 'autoremove', '--purge' );
$self->update();
return;
}

sub makecache ($self) {
my $out = $self->ssystem_capture_output( $apt, 'update' );
my $out = $self->ssystem_capture_output( $apt_get, 'update' );
my @errors = grep { $_ !~ m/apt does not have a stable CLI interface/ } @{ $out->{stderr} };
my $stderr = join "\n", @errors;
return $stderr;
Expand Down
8 changes: 4 additions & 4 deletions lib/Elevate/PkgMgr/APT.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use constant APT_NON_INTERACTIVE_ARGS => qw{
-o Dpkg::Options::=--force-confold
};

our $apt = '/usr/bin/apt';
our $apt_get = '/usr/bin/apt-get';
our $apt_mark = '/usr/bin/apt-mark';
our $dpkg = '/usr/bin/dpkg';
Expand Down Expand Up @@ -197,10 +196,11 @@ sub update ($self) {

my @apt_args = (
'-y',
'--with-new-pkgs',
APT_NON_INTERACTIVE_ARGS,
);

$self->ssystem_and_die( $apt, @apt_args, 'upgrade' );
$self->ssystem_and_die( $apt_get, @apt_args, 'upgrade' );

return;
}
Expand All @@ -218,13 +218,13 @@ sub update_with_options ( $self, $options, $pkgs ) {
}

sub update_allow_erasing ( $self, @additional_args ) {
$self->ssystem_and_die( $apt, '-y', 'autoremove', '--purge' );
$self->ssystem_and_die( $apt_get, '-y', 'autoremove', '--purge' );
$self->update();
return;
}

sub makecache ($self) {
my $out = $self->ssystem_capture_output( $apt, 'update' );
my $out = $self->ssystem_capture_output( $apt_get, 'update' );
my @errors = grep { $_ !~ m/apt does not have a stable CLI interface/ } @{ $out->{stderr} };
my $stderr = join "\n", @errors;
return $stderr;
Expand Down

0 comments on commit f2db87d

Please sign in to comment.