summaryrefslogtreecommitdiff
path: root/apt-pkg/cdrom.cc
diff options
context:
space:
mode:
authorJohn Ogness <john.ogness@linutronix.de>2013-12-13 20:59:31 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-02-12 02:18:37 +0100
commit62dcbf84c4aee8cb01e40c594d4c7f3a23b64836 (patch)
tree0438178b16facfd688bfcc7947d4b237c8481a34 /apt-pkg/cdrom.cc
parent246bbb611d4cd5e2a13ecffb6cbe0e76390eae6f (diff)
apt-cdrom should succeed if any drive succeeds
If there are multiple CD-ROM drives, `apt-cdrom add` will abort with an error if any of the drives do not contain a Debian CD which is against the documentation we have saying "a CD-ROM" and also scripts do not expect it this way. This patch modifies apt-cdrom to return success if any of the drives succeeded. If failures occur, apt-cdrom will still continue trying all the drives and report the last failure (if none of them succeeded). The 'ident' command was also changed to match the new 'add' behavior. Closes: 728153
Diffstat (limited to 'apt-pkg/cdrom.cc')
-rw-r--r--apt-pkg/cdrom.cc26
1 files changed, 24 insertions, 2 deletions
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index a5668a50a..f577e3572 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -577,8 +577,30 @@ bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log) /*{{{*/
CDROM.c_str());
log->Update(msg.str());
}
- if (MountCdrom(CDROM) == false)
- return _error->Error("Failed to mount the cdrom.");
+
+ // Unmount the CD and get the user to put in the one they want
+ if (_config->FindB("APT::CDROM::NoMount",false) == false)
+ {
+ if(log != NULL)
+ log->Update(_("Unmounting CD-ROM\n"), STEP_UNMOUNT);
+ UnmountCdrom(CDROM);
+
+ if(log != NULL)
+ {
+ log->Update(_("Waiting for disc...\n"), STEP_WAIT);
+ if(!log->ChangeCdrom()) {
+ // user aborted
+ return false;
+ }
+ }
+
+ // Mount the new CDROM
+ if(log != NULL)
+ log->Update(_("Mounting CD-ROM...\n"), STEP_MOUNT);
+
+ if (MountCdrom(CDROM) == false)
+ return _error->Error("Failed to mount the cdrom.");
+ }
// Hash the CD to get an ID
if (log != NULL)