summaryrefslogtreecommitdiff
path: root/apt-private
diff options
context:
space:
mode:
Diffstat (limited to 'apt-private')
-rw-r--r--apt-private/private-cmndline.cc1
-rw-r--r--apt-private/private-install.cc12
2 files changed, 13 insertions, 0 deletions
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc
index 6cffbcb48..9234aa278 100644
--- a/apt-private/private-cmndline.cc
+++ b/apt-private/private-cmndline.cc
@@ -435,6 +435,7 @@ static void BinarySpecificConfiguration(char const * const Binary) /*{{{*/
_config->CndSet("Binary::apt::APT::Cmd::Show-Update-Stats", true);
_config->CndSet("Binary::apt::DPkg::Progress-Fancy", true);
_config->CndSet("Binary::apt::Acquire::AllowInsecureRepositories", false);
+ _config->CndSet("Binary::apt::APT::Keep-Downloaded-Packages", false);
}
_config->Set("Binary", binary);
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;
}
/*}}}*/