diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2021-11-17 16:29:09 +0100 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2021-11-17 17:32:18 +0100 |
commit | 891efe3b201a104445ea723a3a5b9b434a78c364 (patch) | |
tree | 11d963be1d3141e311d200b22e00c3717219781b /apt-pkg | |
parent | f4c4f057665adf5d26b6d83be30362fcd837db22 (diff) |
Do not remove Essential/Protected due to dependencies
Suggesting the removal of Essential and Protected packages as a
solution leads to situations where YouTubers end up removing their
desktop.
Let's not remove such packages ourselves.
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/depcache.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 460fb296e..7c19fd7ca 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -930,6 +930,24 @@ static bool IsModeChangeOk(pkgDepCache &Cache, pkgDepCache::ModeList const mode, << " of " << APT::PrettyPkg(&Cache, Pkg) << std::endl; return false; } + // Do not allow removals of essential packages not explicitly triggered by the user + else if (mode == pkgDepCache::ModeDelete && (Pkg->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential && + not _config->FindB("APT::Get::Allow-Solver-Remove-Essential", false)) + { + if (unlikely(DebugMarker == true)) + std::clog << OutputInDepth(Depth) << "Essential prevents Mark" << PrintMode(mode) + << " of " << APT::PrettyPkg(&Cache, Pkg) << std::endl; + return false; + } + // Do not allow removals of essential packages not explicitly triggered by the user + else if (mode == pkgDepCache::ModeDelete && (Pkg->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important && + not _config->FindB("APT::Get::Allow-Solver-Remove-Essential", false)) + { + if (unlikely(DebugMarker == true)) + std::clog << OutputInDepth(Depth) << "Protected prevents Mark" << PrintMode(mode) + << " of " << APT::PrettyPkg(&Cache, Pkg) << std::endl; + return false; + } return true; } |