* apt-pkg/cdrom.cc:
authorMichael Vogt <michael.vogt@ubuntu.com>
Wed, 7 Mar 2007 11:49:33 +0000 (12:49 +0100)
committerMichael Vogt <michael.vogt@ubuntu.com>
Wed, 7 Mar 2007 11:49:33 +0000 (12:49 +0100)
  - only unmount if APT::CDROM::NoMount is false
* methods/cdrom.cc:
  - only umount if it was mounted by the method before

apt-pkg/cdrom.cc
apt-pkg/contrib/cdromutl.h
debian/changelog
methods/cdrom.cc

index 2416887..4d45d38 100644 (file)
@@ -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);
    }
index 3180a03..db140ec 100644 (file)
@@ -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
index 49c3245..a2daa2d 100644 (file)
@@ -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
 
index 556d2c1..601bc11 100644 (file)
@@ -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)