diff options
Diffstat (limited to 'apt-private/private-install.cc')
-rw-r--r-- | apt-private/private-install.cc | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index ecbd703..9a2ed0b 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -227,11 +227,11 @@ bool InstallPackages(CacheFile &Cache, APT::PackageVector &HeldBackPackages, boo // Show all the various warning indicators if (_config->FindI("APT::Output-Version") < 30) ShowDel(c1out,Cache); + if (_config->FindI("APT::Output-Version") >= 30 && _config->FindB("APT::Get::Show-Upgraded",true) == true) + ShowUpgraded(c1out,Cache); ShowNew(c1out,Cache); if (_config->FindI("APT::Output-Version") >= 30) ShowWeakDependencies(Cache); - if (_config->FindI("APT::Output-Version") >= 30 && _config->FindB("APT::Get::Show-Upgraded",true) == true) - ShowUpgraded(c1out,Cache); if (ShwKept == true) { ShowPhasing(c1out, Cache, PhasingPackages); @@ -684,6 +684,16 @@ bool DoAutomaticRemove(CacheFile &Cache) // if we don't remove them, we should show them! if (doAutoRemove == false && autoRemoveCount != 0) { + std::string note; + std::string autocmd = "apt autoremove"; + if (getenv("SUDO_USER") != nullptr) + { + auto const envsudocmd = getenv("SUDO_COMMAND"); + auto const envshell = getenv("SHELL"); + if (envsudocmd == nullptr || envshell == nullptr || strcmp(envsudocmd, envshell) != 0) + autocmd = "sudo " + autocmd; + } + strprintf(note, P_("Use '%s' to remove it.", "Use '%s' to remove them.", autoRemoveCount), autocmd.c_str()); if (smallList == false) { // trigger marking now so that the package list is correct @@ -693,21 +703,14 @@ bool DoAutomaticRemove(CacheFile &Cache) "The following packages were automatically installed and are no longer required:", autoRemoveCount), Universe, [&Cache](pkgCache::PkgIterator const &Pkg) { return (*Cache)[Pkg].Garbage == true && (*Cache)[Pkg].Delete() == false; }, - &PrettyFullName, CandidateVersion(&Cache)); + &PrettyFullName, CandidateVersion(&Cache), "", note); } else + { ioprintf(c1out, P_("%lu package was automatically installed and is no longer required.\n", "%lu packages were automatically installed and are no longer required.\n", autoRemoveCount), autoRemoveCount); - std::string autocmd = "apt autoremove"; - if (getenv("SUDO_USER") != nullptr) - { - auto const envsudocmd = getenv("SUDO_COMMAND"); - auto const envshell = getenv("SHELL"); - if (envsudocmd == nullptr || envshell == nullptr || strcmp(envsudocmd, envshell) != 0) - autocmd = "sudo " + autocmd; + c1out << note << std::endl; } - ioprintf(c1out, P_("Use '%s' to remove it.", "Use '%s' to remove them.", autoRemoveCount), autocmd.c_str()); - c1out << std::endl; } return true; } @@ -1104,7 +1107,7 @@ bool DoInstall(CommandLine &CmdL) if (_config->FindI("APT::Output-Version") < 30 && Cache->InstCount() != verset[MOD_INSTALL].size()) ShowList(c1out, _("The following additional packages will be installed:"), Universe, PkgIsExtraInstalled(&Cache, &verset[MOD_INSTALL]), - &PrettyFullName, CandidateVersion(&Cache), "APT::Color::Green"); + &PrettyFullName, CandidateVersion(&Cache), "action::install-dependencies"); /* Print out a list of suggested and recommended packages */ if (_config->FindI("APT::Output-Version") < 30) |