summaryrefslogtreecommitdiff
path: root/apt-private
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2023-09-16 12:34:48 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2023-09-16 12:37:31 +0200
commit99c888b5eabbb7008bf4451bc62c277f28bb925f (patch)
tree2375ab845a8c66a368bae090b799d819287ee589 /apt-private
parent52dd18670bf7d22ecf234141d3c7b7b9f67c6fa3 (diff)
Only accept installs of usrmerge on unmerged-usr systems
As of bookworm, merged-usr is mandatory, and people got caught in the crosshairs of the dpkg fsys-unmessusr debacle and inadvertently reverted back to an unmerged configuration and continue to remain on an unsupported system unknowingly. Help them by erroring out when they are installing packages on /, they are not in a chroot, and a usrmerge package is available.
Diffstat (limited to 'apt-private')
-rw-r--r--apt-private/private-install.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index 13ed35e2a..a195df848 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -215,6 +215,26 @@ bool InstallPackages(CacheFile &Cache, APT::PackageVector &HeldBackPackages, boo
if (Cache->DelCount() != 0 && _config->FindB("APT::Get::Remove",true) == false)
return _error->Error(_("Packages need to be removed but remove is disabled."));
+#ifdef REQUIRE_MERGED_USR
+ _error->PushToStack();
+ auto usrmergePkg = Cache->FindPkg("usrmerge");
+ if (not APT::Configuration::isChroot() && _config->FindDir("Dir") == std::string("/") &&
+ not usrmergePkg.end() && not usrmergePkg.VersionList().end() &&
+ not Cache[usrmergePkg].Install() && not APT::Configuration::checkUsrMerged())
+ {
+ _error->Error(_("Unmerged usr is no longer supported, install usrmerge to continue."));
+ for (auto VF = usrmergePkg.VersionList().FileList(); not VF.end(); ++VF)
+ if (VF.File().Origin() == std::string("Debian"))
+ {
+ // TRANSLATORS: %s is a url to a page describing merged-usr (bookworm release notes)
+ _error->Notice(_("See %s for more details."), "https://www.debian.org/releases/bookworm/amd64/release-notes/ch-information.en.html#a-merged-usr-is-now-required");
+ break;
+ }
+ return false;
+ }
+ _error->RevertToStack();
+#endif
+
// Fail safe check
bool const Fail = (Essential || Downgrade || Hold);
if (_config->FindI("quiet",0) >= 2 ||