summaryrefslogtreecommitdiff
path: root/methods/cdrom.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:54:53 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:54:53 +0000
commit8e5fc8f5bea54e3c016a14fe4025dcb94864e874 (patch)
tree19a21ecb2b8ee6f53e7cd287d7c11c4514105eb7 /methods/cdrom.cc
parent08cfc005c3529d4ff63d229b05d75c6ceb88225b (diff)
CDROMs are unmounted
Author: jgg Date: 1999-10-18 00:37:35 GMT CDROMs are unmounted
Diffstat (limited to 'methods/cdrom.cc')
-rw-r--r--methods/cdrom.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/methods/cdrom.cc b/methods/cdrom.cc
index befd531a6..e2eddf19e 100644
--- a/methods/cdrom.cc
+++ b/methods/cdrom.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: cdrom.cc,v 1.15 1999/10/02 04:14:54 jgg Exp $
+// $Id: cdrom.cc,v 1.16 1999/10/18 00:37:36 jgg Exp $
/* ######################################################################
CDROM URI method for APT
@@ -23,9 +23,12 @@ class CDROMMethod : public pkgAcqMethod
bool DatabaseLoaded;
::Configuration Database;
string CurrentID;
+ string CDROM;
+ bool Mounted;
virtual bool Fetch(FetchItem *Itm);
string GetID(string Name);
+ virtual void Exit();
public:
@@ -36,10 +39,21 @@ class CDROMMethod : public pkgAcqMethod
// ---------------------------------------------------------------------
/* */
CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly |
- SendConfig), DatabaseLoaded(false)
+ SendConfig | NeedsCleanup),
+ DatabaseLoaded(false),
+ Mounted(false)
{
};
/*}}}*/
+// CDROMMethod::Exit - Unmount the disc if necessary /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void CDROMMethod::Exit()
+{
+ if (Mounted == true)
+ UnmountCdrom(CDROM);
+}
+ /*}}}*/
// CDROMMethod::GetID - Search the database for a matching string /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -111,7 +125,7 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
return true;
}
- string CDROM = _config->FindDir("Acquire::cdrom::mount","/cdrom/");
+ CDROM = _config->FindDir("Acquire::cdrom::mount","/cdrom/");
if (CDROM[0] == '.')
CDROM= SafeGetCWD() + '/' + CDROM;
string NewID;
@@ -149,6 +163,7 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
}
MountCdrom(CDROM);
+ Mounted = true;
}
// Found a CD