]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-worker.cc
* meda-change message is send over status-fd now
[apt.git] / apt-pkg / acquire-worker.cc
index 5cd7d6f1e640458aef11edffb85357605bbdec97..e2b8bf9e4f01841bce2b41c04360a4d8b7cd01ed 100644 (file)
@@ -25,6 +25,7 @@
 #include <apti18n.h>
 
 #include <iostream>
+#include <sstream>
 #include <fstream>
     
 #include <sys/stat.h>
@@ -367,6 +368,19 @@ 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;
+      status << "media-change: "  // message
+            << Media  << ":"     //media
+            << Drive  //drive
+            << endl;
+      write(status_fd, status.str().c_str(), status.str().size());
+   }
+
    if (Log == 0 || Log->MediaChange(LookupTag(Message,"Media"),
                                    LookupTag(Message,"Drive")) == false)
    {