+ // Number of bytes
+ c2out << "Need to get ";
+ if (DebBytes != FetchBytes)
+ c2out << SizeToStr(FetchBytes) << '/' << SizeToStr(DebBytes);
+ else
+ c2out << SizeToStr(DebBytes);
+
+ c1out << " of archives. After unpacking ";
+
+ // Size delta
+ if (Cache->UsrSize() >= 0)
+ c2out << SizeToStr(Cache->UsrSize()) << " will be used." << endl;
+ else
+ c2out << SizeToStr(-1*Cache->UsrSize()) << " will be freed." << endl;
+
+ if (_error->PendingError() == true)
+ return false;
+
+ // Fail safe check
+ if (_config->FindB("APT::Get::Assume-Yes",false) == true)
+ {
+ if (Fail == true && _config->FindB("APT::Get::Force-Yes",false) == false)
+ return _error->Error("There are problems and -y was used without --force-yes");
+ }
+
+ // Prompt to continue
+ if (Ask == true)
+ {
+ if (_config->FindI("quiet",0) < 2 ||
+ _config->FindB("APT::Get::Assume-Yes",false) == false)
+ c2out << "Do you want to continue? [Y/n] " << flush;
+
+ if (YnPrompt() == false)
+ exit(1);
+ }
+
+ // Run it
+ if (Fetcher.Run() == false)
+ return false;
+
+ // Print out errors
+ bool Failed = false;
+ bool Transient = false;
+ for (pkgAcquire::Item **I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
+ {
+ if ((*I)->Status == pkgAcquire::Item::StatDone &&
+ (*I)->Complete == true)
+ continue;
+
+ if ((*I)->Status == pkgAcquire::Item::StatIdle)
+ {
+ Transient = true;
+ Failed = true;
+ continue;
+ }
+
+ cerr << "Failed to fetch " << (*I)->Describe() << endl;
+ cerr << " " << (*I)->ErrorText << endl;
+ Failed = true;
+ }
+
+ if (_config->FindB("APT::Get::Download-Only",false) == true)
+ return true;
+
+ if (Failed == true && _config->FindB("APT::Get::Fix-Missing",false) == false)
+ {
+ if (Transient == true)
+ {
+ c2out << "Upgrading with disk swapping is not supported in this version." << endl;
+ c2out << "Try running multiple times with --fix-missing" << endl;
+ }
+
+ return _error->Error("Unable to fetch some archives, maybe try with --fix-missing?");
+ }
+
+ // Try to deal with missing package files
+ if (PM.FixMissing() == false)
+ {
+ cerr << "Unable to correct missing packages." << endl;
+ return _error->Error("Aborting Install.");
+ }
+
+ Cache.Lock.Close();
+ return PM.DoInstall();