]> git.saurik.com Git - apt.git/blobdiff - methods/cdrom.cc
merged from the lp:~mvo/apt/libudev-dlopen branch
[apt.git] / methods / cdrom.cc
index 87794b052a08b3da087ab053b424b63723c922e7..4bbc01c2c895372ec1297a0828e6a6934466c07a 100644 (file)
@@ -92,7 +92,7 @@ string CDROMMethod::GetID(string Name)
 // CDROMMethod::AutoDetectAndMount                                      /*{{{*/
 // ---------------------------------------------------------------------
 /* Modifies class varaiable CDROM to the mountpoint */
-bool CDROMMethod::AutoDetectAndMount(URI Get, string NewID)
+bool CDROMMethod::AutoDetectAndMount(URI Get, string &NewID)
 {
    vector<struct CdromDevice> v = UdevCdroms.Scan();
 
@@ -116,23 +116,24 @@ bool CDROMMethod::AutoDetectAndMount(URI Get, string NewID)
       return false;
 
    // check if we have the mount point
-   if (!FileExists("/media/apt"))
-      mkdir("/media/apt", 0755);
+   string AptMountPoint = _config->FindDir("Dir::Media::MountPath");
+   if (!FileExists(AptMountPoint))
+      mkdir(AptMountPoint.c_str(), 0750);
 
    // now try mounting
    for (unsigned int i=0; i < v.size(); i++)
    {
       if (!v[i].Mounted)
       {
-        if(MountCdrom("/media/apt", v[i].DeviceName)) 
+        if(MountCdrom(AptMountPoint, v[i].DeviceName)) 
         {
-           if (IsCorrectCD(Get, "/media/apt", NewID))
+           if (IsCorrectCD(Get, AptMountPoint, NewID))
            {
               MountedByApt = true;
-              CDROM = "/media/apt";
+              CDROM = AptMountPoint;
               return true;
            } else {
-              UnmountCdrom("/media/apt");
+              UnmountCdrom(AptMountPoint);
            }
         }
       }