+}
+bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
+{
+ if (_config->FindB("APT::Get::Purge", false) == true)
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() == false; ++I)
+ if (Cache[I].Delete() == true && Cache[I].Purge() == false)
+ Cache->MarkDelete(I,true);
+
+ // Create the download object
+ aptAcquireWithTextStatus Fetcher;
+ if (_config->FindB("APT::Get::Print-URIs", false) == true)
+ {
+ // 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;
+
+ // Read the source list
+ if (Cache.BuildSourceList() == false)
+ return false;
+ pkgSourceList * const List = Cache.GetSourceList();
+
+ // Create the text record parser
+ pkgRecords Recs(Cache);
+ if (_error->PendingError() == true)
+ return false;
+
+ // Create the package manager and prepare to download
+ std::unique_ptr<pkgPackageManager> PM(_system->CreatePM(Cache));
+ if (PM->GetArchives(&Fetcher,List,&Recs) == false ||
+ _error->PendingError() == true)
+ return false;
+
+ if (_config->FindB("APT::Get::Fix-Missing",false) == true &&
+ _config->FindB("APT::Get::Download",true) == false)
+ {
+ bool Missing = false;
+ RemoveDownloadNeedingItemsFromFetcher(Fetcher, Missing);
+ if (Missing)
+ PM->FixMissing();
+ Fetcher.Shutdown();
+ if (PM->GetArchives(&Fetcher,List,&Recs) == false ||
+ _error->PendingError() == true)
+ return false;
+ }
+