]> git.saurik.com Git - apt.git/blobdiff - apt-private/private-install.cc
Add new APT::Keep-Downloaded-Packages option
[apt.git] / apt-private / private-install.cc
index 74a2424c56d2ef19d0fc284a5b3607b7e48507ef..73aebaf2f5dc7a140f69ffa51d5622c5578bee34 100644 (file)
@@ -346,6 +346,18 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
       c0out << _("Note: This is done automatically and on purpose by dpkg.") << std::endl;
    }
 
+   // cleanup downloaded debs
+   if (_config->FindB("APT::Keep-Downloaded-Packages", true) == false)
+   {
+      std::string const archivedir = _config->FindDir("Dir::Cache::archives");
+      for (auto I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); ++I)
+      {
+        if (flNotFile((*I)->DestFile) != archivedir || (*I)->Local)
+           continue;
+         RemoveFile("Keep-Downloaded-Packages=false", (*I)->DestFile);
+      }
+   }
+
    return true;
 }
                                                                        /*}}}*/