summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2007-03-07 12:49:33 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2007-03-07 12:49:33 +0100
commit70dbf5f8f3e6e3526c82c72ed1795d9f2dad0338 (patch)
treeb66dbe5f093cf7940593501e16e571f1f83c12ae
parent25a04630d6eef123a62f50703b82cc62acf1fbfb (diff)
downloadapt-70dbf5f8f3e6e3526c82c72ed1795d9f2dad0338.tar.gz
* 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
-rw-r--r--apt-pkg/cdrom.cc9
-rw-r--r--apt-pkg/contrib/cdromutl.h3
-rw-r--r--debian/changelog9
-rw-r--r--methods/cdrom.cc10
4 files changed, 15 insertions, 16 deletions
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index 241688785..4d45d38a2 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -508,10 +508,8 @@ bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log)
CDROM.c_str());
log->Update(msg.str());
}
-
- if (_config->FindB("APT::CDROM::NoMount",false) == false)
- if (MountCdrom(CDROM) == false)
- return _error->Error("Failed to mount the cdrom.");
+ if (MountCdrom(CDROM) == false)
+ return _error->Error("Failed to mount the cdrom.");
// Hash the CD to get an ID
if(log)
@@ -805,8 +803,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
// Unmount and finish
- if (_config->FindB("APT::CDROM::NoMount",false) == false &&
- _config->FindB("APT::CDROM::UnMountOnFinish",true) == true) {
+ if (_config->FindB("APT::CDROM::NoMount",false) == false) {
log->Update(_("Unmounting CD-ROM..."), STEP_LAST);
UnmountCdrom(CDROM);
}
diff --git a/apt-pkg/contrib/cdromutl.h b/apt-pkg/contrib/cdromutl.h
index 3180a03c7..db140ec02 100644
--- a/apt-pkg/contrib/cdromutl.h
+++ b/apt-pkg/contrib/cdromutl.h
@@ -8,7 +8,7 @@
##################################################################### */
/*}}}*/
#ifndef PKGLIB_CDROMUTL_H
-#define PKGLIB_ACQUIRE_METHOD_H
+#define PKGLIB_CDROMUTL_H
#include <string>
@@ -21,5 +21,6 @@ using std::string;
bool MountCdrom(string Path);
bool UnmountCdrom(string Path);
bool IdentCdrom(string CD,string &Res,unsigned int Version = 2);
+bool IsMounted(string &Path);
#endif
diff --git a/debian/changelog b/debian/changelog
index 49c324545..a2daa2d3a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,11 +10,12 @@ apt (0.6.46.5) UNRELEASED; urgency=low
- send apt version in User-Agent
* apt-pkg/deb/debrecords.cc:
- fix SHA1Hash() return value
- * apt-pkg/cdrom.cc, methods/cdrom.cc:
- - added APT::CDROM::UnMountOnFinish to have more control over
- the umount/mount process
+ * 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
- -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 7 Mar 2007 12:03:50 +0100
+ -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 18 Dec 2006 19:39:05 +0100
apt (0.6.46.4) unstable; urgency=high
diff --git a/methods/cdrom.cc b/methods/cdrom.cc
index 556d2c1a6..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,8 +57,7 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly |
/* */
void CDROMMethod::Exit()
{
- if (Mounted == true &&
- _config->FindB("APT::CDROM::UnMountOnFinish",true) == true)
+ if (MountedByApt == true)
UnmountCdrom(CDROM);
}
/*}}}*/
@@ -140,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)