Browse Source

* meda-change message is send over status-fd now

tags/debian/0.7.21
Michael Vogt 16 years ago
parent
commit
80a26ed1fb
2 changed files with 22 additions and 1 deletions
  1. +8
    -1
      README.progress-reporting
  2. +14
    -0
      apt-pkg/acquire-worker.cc

+ 8
- 1
README.progress-reporting View File

@@ -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
--------


+ 14
- 0
apt-pkg/acquire-worker.cc View 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)
{


Loading…
Cancel
Save