]> git.saurik.com Git - apt.git/commitdiff
add Dir::Media::MountPath config option
authorMichael Vogt <michael.vogt@ubuntu.com>
Tue, 26 Jan 2010 20:08:41 +0000 (21:08 +0100)
committerMichael Vogt <michael.vogt@ubuntu.com>
Tue, 26 Jan 2010 20:08:41 +0000 (21:08 +0100)
apt-pkg/init.cc
cmdline/apt-cdrom.cc
doc/examples/configure-index
methods/cdrom.cc

index 2544b8025a8218d3584f2f1ca2853ebb38a02c35..6310aff112a1ae94ecd4e587e1fed27ecf47dc49 100644 (file)
@@ -65,11 +65,12 @@ bool pkgInitConfig(Configuration &Cnf)
    Cnf.Set("Dir::Etc::vendorlist","vendors.list");
    Cnf.Set("Dir::Etc::vendorparts","vendors.list.d");
    Cnf.Set("Dir::Etc::main","apt.conf");
-   Cnf.Set("Dir::ETc::netrc", "auth.conf");
+   Cnf.Set("Dir::Etc::netrc", "auth.conf");
    Cnf.Set("Dir::Etc::parts","apt.conf.d");
    Cnf.Set("Dir::Etc::preferences","preferences");
    Cnf.Set("Dir::Etc::preferencesparts","preferences.d");
    Cnf.Set("Dir::Bin::methods","/usr/lib/apt/methods");
+   Cnf.Set("Dir::Media::MountPath","/media/apt");
 
    // State   
    Cnf.Set("Dir::Log","var/log/apt");
index 494a7d8df22a8a1f2b08332a2efc20cb23d32099..988a58f20eace57c57a7076345daaa68d8aa9882 100644 (file)
@@ -120,11 +120,11 @@ bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i)
       _config->Set("Acquire::cdrom::mount", v[i].MountPath);
       _config->Set("APT::CDROM::NoMount", true);
    } else {
-      const char* AptMountPoint = "/media/apt";
+      string AptMountPoint = _config->FindDir("Dir::Media::MountPath");
       if (!FileExists(AptMountPoint))
-        mkdir(AptMountPoint, 0750);
+        mkdir(AptMountPoint.c_str(), 0750);
       if(MountCdrom(AptMountPoint, v[i].DeviceName) == false)
-        _error->Warning(_("Failed to mount '%s' to '%s'"), v[i].DeviceName.c_str(), AptMountPoint);
+        _error->Warning(_("Failed to mount '%s' to '%s'"), v[i].DeviceName.c_str(), AptMountPoint.c_str());
       _config->Set("Acquire::cdrom::mount", AptMountPoint);
       _config->Set("APT::CDROM::NoMount", true);
    }
index 317acddf66ee05bda93cd56e59834464310fa711..0b0025fca2d3a2584a01a008d639d1e3615b2d8e 100644 (file)
@@ -331,6 +331,13 @@ Dir "/"
        Terminal "term.log";
        History "history.log";
   };
+
+  // Media 
+  Media 
+  {
+       // Media AutoDetect mount path
+       MountPath "/media/apt";
+  };
 };
 
 // Things that effect the APT dselect method
index c8ec322ee9b6b716c9a34b9f43d006334791bbb1..4bbc01c2c895372ec1297a0828e6a6934466c07a 100644 (file)
@@ -116,9 +116,9 @@ bool CDROMMethod::AutoDetectAndMount(URI Get, string &NewID)
       return false;
 
    // check if we have the mount point
-   const char* AptMountPoint = "/media/apt";
+   string AptMountPoint = _config->FindDir("Dir::Media::MountPath");
    if (!FileExists(AptMountPoint))
-      mkdir(AptMountPoint, 0750);
+      mkdir(AptMountPoint.c_str(), 0750);
 
    // now try mounting
    for (unsigned int i=0; i < v.size(); i++)