X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/24a0d63a0285b4f656fe6ef63d2fb413c24eece1..a345a69945548525d5219fcd18e3754f4d252bfd:/apt-pkg/acquire-worker.cc diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 5cd7d6f1e..8ab67778b 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -306,6 +307,13 @@ bool pkgAcquire::Worker::RunMessages() pkgAcquire::Item *Owner = Itm->Owner; pkgAcquire::ItemDesc Desc = *Itm; OwnerQ->ItemDone(Itm); + + // set some status + if(LookupTag(Message,"FailReason") == "Timeout" || + LookupTag(Message,"FailReason") == "TmpResolveFailure" || + LookupTag(Message,"FailReason") == "ConnectionRefused") + Owner->Status = pkgAcquire::Item::StatTransientNetworkError; + Owner->Failed(Message,Config); ItemDone(); @@ -367,6 +375,24 @@ bool pkgAcquire::Worker::Capabilities(string Message) /* */ bool pkgAcquire::Worker::MediaChange(string Message) { + int status_fd = _config->FindI("APT::Status-Fd",-1); + if(status_fd > 0) + { + string Media = LookupTag(Message,"Media"); + string Drive = LookupTag(Message,"Drive"); + ostringstream msg,status; + ioprintf(msg,_("Please insert the disc labeled: " + "'%s' " + "in the drive '%s' and press enter."), + Media.c_str(),Drive.c_str()); + status << "media-change: " // message + << Media << ":" // media + << Drive << ":" // drive + << msg.str() // l10n message + << endl; + write(status_fd, status.str().c_str(), status.str().size()); + } + if (Log == 0 || Log->MediaChange(LookupTag(Message,"Media"), LookupTag(Message,"Drive")) == false) {