From 5fddde78ad15e1f6160f65465139d2c1e416d047 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 8 Jan 2021 13:22:30 +0100 Subject: Only autoremove kernels in apt(8); respect --no-auto-remove Automatically removing kernels in apt-get could be unexpected, so limit it to apt for now. To handle --no-auto-remove correctly, rewrite the hack that makes apt ignore APT::Get::AutomaticRemove options from config files such that it unsets the option. This then means we can do FindB("APT::Get::AutomaticRemove", true) as the default for APT::Get::AutomaticRemove::Kernels and get the behavior we want: If you set --no-auto-remove, it is respected as that FindB returns false; if you don't set it, it will be true. --- apt-private/private-install.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-private/private-install.cc') diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index b110cbdc3..402f8f4b6 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -699,8 +699,8 @@ bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vectorCndSet("APT::Get::AutomaticRemove::Kernels", "true"); + if (distUpgradeMode && _config->Find("Binary") == "apt") + _config->CndSet("APT::Get::AutomaticRemove::Kernels", _config->FindB("APT::Get::AutomaticRemove", true)); bool resolver_fail = false; if (distUpgradeMode == true || UpgradeMode != APT::Upgrade::ALLOW_EVERYTHING) -- cgit v1.2.3