X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/eb1f04dda07c2b69549ad9fd793cca0e91841b3e..d8a57c1953b876917a9deb098d1ef3d2b093f3dc:/apt-private/private-install.cc?ds=sidebyside diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 213b3b90c..aa28780da 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -111,6 +111,8 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety) // force a hashsum for compatibility reasons _config->CndSet("Acquire::ForceHash", "md5sum"); } + else if (_config->FindB("APT::Get::Simulate") == true) + ; else if (Fetcher.GetLock(_config->FindDir("Dir::Cache::Archives")) == false) return false; @@ -255,7 +257,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety) pkgAcquire::UriIterator I = Fetcher.UriBegin(); for (; I != Fetcher.UriEnd(); ++I) std::cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << - I->Owner->FileSize << ' ' << I->Owner->HashSum() << std::endl; + std::to_string(I->Owner->FileSize) << ' ' << I->Owner->HashSum() << std::endl; return true; } @@ -519,8 +521,13 @@ bool DoAutomaticRemove(CacheFile &Cache) 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") != NULL) - autocmd = "sudo " + autocmd; + 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; + } ioprintf(c1out, P_("Use '%s' to remove it.", "Use '%s' to remove them.", autoRemoveCount), autocmd.c_str()); c1out << std::endl; } @@ -533,15 +540,15 @@ static const unsigned short MOD_INSTALL = 2; bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache, int UpgradeMode) { - std::vector VolatileCmdL; + std::vector VolatileCmdL; return DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, UpgradeMode); } -bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector &VolatileCmdL, CacheFile &Cache, int UpgradeMode) +bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector &VolatileCmdL, CacheFile &Cache, int UpgradeMode) { std::map verset; return DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, verset, UpgradeMode); } -bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector &VolatileCmdL, CacheFile &Cache, +bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector &VolatileCmdL, CacheFile &Cache, std::map &verset, int UpgradeMode) { // Enter the special broken fixing mode if the user specified arguments @@ -687,7 +694,7 @@ struct PkgIsExtraInstalled { bool DoInstall(CommandLine &CmdL) { CacheFile Cache; - std::vector VolatileCmdL; + std::vector VolatileCmdL; Cache.GetSourceList()->AddVolatileFiles(CmdL, &VolatileCmdL); // then open the cache