diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2007-03-07 13:00:35 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2007-03-07 13:00:35 +0100 |
commit | e29dfa9ebfe9940089697fbb3e436e8ff95ecad6 (patch) | |
tree | b8adbb7dc2d9927c94cc95911f1bb745739814fc /methods | |
parent | 07cf8a2fd6b6472ea8d98573c18b010ef8b66ed4 (diff) | |
parent | 70dbf5f8f3e6e3526c82c72ed1795d9f2dad0338 (diff) |
* apt-pkg/cdrom.cc:
- only unmount if APT::CDROM::NoMount is false
* methods/cdrom.cc:
- only umount if it was mounted by the method before
Diffstat (limited to 'methods')
-rw-r--r-- | methods/cdrom.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/methods/cdrom.cc b/methods/cdrom.cc index d6b8eae75..601bc11c9 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -30,7 +30,7 @@ class CDROMMethod : public pkgAcqMethod ::Configuration Database; string CurrentID; string CDROM; - bool Mounted; + bool MountedByApt; virtual bool Fetch(FetchItem *Itm); string GetID(string Name); @@ -48,7 +48,7 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly | SendConfig | NeedsCleanup | Removable), DatabaseLoaded(false), - Mounted(false) + MountedByApt(false) { }; /*}}}*/ @@ -57,7 +57,7 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly | /* */ void CDROMMethod::Exit() { - if (Mounted == true) + if (MountedByApt == true) UnmountCdrom(CDROM); } /*}}}*/ @@ -139,7 +139,8 @@ bool CDROMMethod::Fetch(FetchItem *Itm) while (CurrentID.empty() == true) { bool Hit = false; - Mounted = MountCdrom(CDROM); + if(!IsMounted(CDROM)) + MountedByApt = MountCdrom(CDROM); for (unsigned int Version = 2; Version != 0; Version--) { if (IdentCdrom(CDROM,NewID,Version) == false) @@ -160,7 +161,8 @@ bool CDROMMethod::Fetch(FetchItem *Itm) break; // I suppose this should prompt somehow? - if (UnmountCdrom(CDROM) == false) + if (_config->FindB("APT::CDROM::NoMount",false) == false && + UnmountCdrom(CDROM) == false) return _error->Error(_("Unable to unmount the CD-ROM in %s, it may still be in use."), CDROM.c_str()); if (MediaFail(Get.Host,CDROM) == false) |