]> git.saurik.com Git - apt.git/commitdiff
* apt-pkg/cdrom.cc:
authorMichael Vogt <michael.vogt@ubuntu.com>
Wed, 7 Mar 2007 12:00:35 +0000 (13:00 +0100)
committerMichael Vogt <michael.vogt@ubuntu.com>
Wed, 7 Mar 2007 12:00:35 +0000 (13:00 +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
configure.in
debian/changelog
methods/cdrom.cc

index b42c82dd0f0e9fedbcb245668e505dd65a9535e6..aefe9c9e976c33582d01a3df32eaa162513a616f 100644 (file)
@@ -679,7 +679,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
 
    if (List.size() == 0 && SourceList.size() == 0) 
    {
-      UnmountCdrom(CDROM);
+      if (_config->FindB("APT::CDROM::NoMount",false) == false) 
+        UnmountCdrom(CDROM);
       return _error->Error("Unable to locate any package files, perhaps this is not a Debian Disc");
    }
 
@@ -718,7 +719,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
       {
         if(!log) 
          {
-           UnmountCdrom(CDROM);
+           if (_config->FindB("APT::CDROM::NoMount",false) == false) 
+              UnmountCdrom(CDROM);
            return _error->Error("No disc name found and no way to ask for it");
         }
 
@@ -796,7 +798,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
       string::size_type Space = (*I).find(' ');
       if (Space == string::npos)
       {
-        UnmountCdrom(CDROM);
+        if (_config->FindB("APT::CDROM::NoMount",false) == false) 
+           UnmountCdrom(CDROM);
         return _error->Error("Internal error");
       }
 
@@ -813,7 +816,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
       string::size_type Space = (*I).find(' ');
       if (Space == string::npos)
       {
-        UnmountCdrom(CDROM);
+        if (_config->FindB("APT::CDROM::NoMount",false) == false) 
+           UnmountCdrom(CDROM);
         return _error->Error("Internal error");
       }
 
index 3180a03c70f4bcf6a54fbf18d7b2382f19b4b5f6..db140ec02d256e13c52aaf147c7380ddb33a1b18 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 7d93de95555698cdc3b75b6bbd903000b049be10..940601e21842a8e16391cb87757b1cf871d8efec 100644 (file)
@@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
 
 dnl -- SET THIS TO THE RELEASE VERSION --
-AC_DEFINE_UNQUOTED(VERSION,"0.6.46.4ubuntu8")
+AC_DEFINE_UNQUOTED(VERSION,"0.6.46.4ubuntu9")
 PACKAGE="apt"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_SUBST(PACKAGE)
index 90ded8c3acbd1c33216e697e7385349277e14531..7a09847c839994635611b352b939e7c38fa663c1 100644 (file)
@@ -3,8 +3,12 @@ apt (0.6.46.4ubuntu9) feisty; urgency=low
   * debian/control:
     - set XS-Vcs-Bzr header
     - Set Ubuntu maintainer address
+  * 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:51:17 +0100
 
 apt (0.6.46.4ubuntu8) feisty; urgency=low
 
index d6b8eae75c0dd4d6c810f0ab720b997c09dfdb76..601bc11c9039037fe94b3c78fb54d67d94d2c63d 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,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)