summaryrefslogtreecommitdiff
path: root/apt-private/private-install.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2016-01-02 22:08:30 +0100
committerMichael Vogt <mvo@ubuntu.com>2016-01-02 22:18:13 +0100
commitee02b5b3949372a178d37cadaa08db0bfd5b991f (patch)
tree873cb79c1a6e86b8dfffe5f65604665c70adb17c /apt-private/private-install.cc
parentbd8274311db48fdcc78456c17c2d59497b96cc2f (diff)
Add new APT::Keep-Downloaded-Packages option
This option controls if downloaded packages should be kept after a successful install or if they should be deleted. The default for "apt-get" is that they are kept (just like before). However the default for "apt" is that they get deleted. Closes: #160743
Diffstat (limited to 'apt-private/private-install.cc')
-rw-r--r--apt-private/private-install.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index 74a2424c5..73aebaf2f 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -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;
}
/*}}}*/