diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-08-31 14:56:28 +0000 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-08-31 14:56:28 +0000 |
commit | 80a26ed1fb36c6cdc07a4dc08ed46a405065b949 (patch) | |
tree | 9263d75d7f1d2f33b9124e870009a20e593351e3 | |
parent | c320a1e61a5911fb7fdc67914e95a6fd66950ee4 (diff) |
* meda-change message is send over status-fd now
-rw-r--r-- | README.progress-reporting | 9 | ||||
-rw-r--r-- | apt-pkg/acquire-worker.cc | 14 |
2 files changed, 22 insertions, 1 deletions
diff --git a/README.progress-reporting b/README.progress-reporting index 73fbd8c08..285ca6190 100644 --- a/README.progress-reporting +++ b/README.progress-reporting @@ -5,7 +5,7 @@ If the apt options: "APT::Status-Fd" is set, apt will send status reports to that fd. The status information is seperated with a ':', there are the following status conditions: -status = {"pmstatus", "dlstatus", "conffile-prompt", "error" } +status = {"pmstatus", "dlstatus", "conffile-prompt", "error", "media-change" } The reason for using a fd instead of a OpProgress class is that many apt frontend fork a (vte) terminal for the actual installation. @@ -47,6 +47,13 @@ pmconffile pmconffile:conffile:percent:'current-conffile' 'new-conffile' useredited distedited +media-change +------------ +media-change:medium:drive + +example: +media-change: Ubuntu 5.10 _Breezy Badger_ - Alpha i386 (20050830):/cdrom/ + dlstatus -------- diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 5cd7d6f1e..e2b8bf9e4 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,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) { |