summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-worker.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/acquire-worker.cc')
-rw-r--r--apt-pkg/acquire-worker.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc
index 5cd7d6f1e..d06024178 100644
--- a/apt-pkg/acquire-worker.cc
+++ b/apt-pkg/acquire-worker.cc
@@ -25,6 +25,7 @@
#include <apti18n.h>
#include <iostream>
+#include <sstream>
#include <fstream>
#include <sys/stat.h>
@@ -367,6 +368,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)
{