Bladeren bron

* 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 19 jaren geleden
bovenliggende
commit
70dbf5f8f3
4 gewijzigde bestanden met toevoegingen van 15 en 16 verwijderingen
  1. 3 6
      apt-pkg/cdrom.cc
  2. 2 1
      apt-pkg/contrib/cdromutl.h
  3. 5 4
      debian/changelog
  4. 5 5
      methods/cdrom.cc

+ 3 - 6
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);
    }

+ 2 - 1
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

+ 5 - 4
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
 

+ 5 - 5
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)