]> git.saurik.com Git - apt.git/blobdiff - apt-private/private-install.cc
Japanese manpages translation update
[apt.git] / apt-private / private-install.cc
index 7bd9a603449dd99b856aa10bda3c2dce97454e8a..fab742dc7244c167765c9564ad8dc5c0f4a67bdf 100644 (file)
@@ -48,6 +48,10 @@ bool CheckNothingBroken(CacheFile &Cache)                            /*{{{*/
    if (Cache->BrokenCount() == 0)
       return true;
 
+   // FIXME: if an external solver showed an error, we shouldn't show one here
+   if (_error->PendingError() && _config->Find("APT::Solver") == "dump")
+      return false;
+
    c1out <<
       _("Some packages could not be installed. This may mean that you have\n"
            "requested an impossible situation or if you are using the unstable\n"
@@ -521,8 +525,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;
    }
@@ -535,15 +544,15 @@ static const unsigned short MOD_INSTALL = 2;
 
 bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache, int UpgradeMode)
 {
-   std::vector<const char*> VolatileCmdL;
+   std::vector<std::string> VolatileCmdL;
    return DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, UpgradeMode);
 }
-bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector<const char*> &VolatileCmdL, CacheFile &Cache, int UpgradeMode)
+bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector<std::string> &VolatileCmdL, CacheFile &Cache, int UpgradeMode)
 {
    std::map<unsigned short, APT::VersionSet> verset;
    return DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, verset, UpgradeMode);
 }
-bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector<const char*> &VolatileCmdL, CacheFile &Cache,
+bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector<std::string> &VolatileCmdL, CacheFile &Cache,
                                         std::map<unsigned short, APT::VersionSet> &verset, int UpgradeMode)
 {
    // Enter the special broken fixing mode if the user specified arguments
@@ -689,7 +698,7 @@ struct PkgIsExtraInstalled {
 bool DoInstall(CommandLine &CmdL)
 {
    CacheFile Cache;
-   std::vector<char const *> VolatileCmdL;
+   std::vector<std::string> VolatileCmdL;
    Cache.GetSourceList()->AddVolatileFiles(CmdL, &VolatileCmdL);
 
    // then open the cache