Procházet zdrojové kódy

* apt-pkg/contrib/cdromutl.cc:
- if apt-cdrom is used on writable media (like usb-sticks), do
not use the root directory to identify the medium (as all
changes there change the ident id). Use the .disk directory
instead

Michael Vogt před 16 roky
rodič
revize
2a001232db
2 změnil soubory, kde provedl 15 přidání a 0 odebrání
  1. 10 0
      apt-pkg/contrib/cdromutl.cc
  2. 5 0
      debian/changelog

+ 10 - 0
apt-pkg/contrib/cdromutl.cc

@@ -157,6 +157,16 @@ bool IdentCdrom(string CD,string &Res,unsigned int Version)
 {
    MD5Summation Hash;
 
+   // if we are on a writable medium (like a usb-stick) that is just
+   // used like a cdrom don't use "." as it will constantly change,
+   // use .disk instead
+   if (access(CD.c_str(), W_OK) == 0 && DirectoryExists(CD+string("/.disk"))) {
+      CD = CD+string("/.disk");
+      if (_config->FindB("Debug::aptcdrom",false) == true)
+         std::clog << "Found writable cdrom, using alternative path: "
+                   << CD.c_str() << std::endl;
+   }
+
    string StartDir = SafeGetCWD();
    if (chdir(CD.c_str()) != 0)
       return _error->Errno("chdir",_("Unable to change to %s"),CD.c_str());

+ 5 - 0
debian/changelog

@@ -4,6 +4,11 @@ apt (0.8.2) unstable; urgency=low
     - only use trusted.gpg.d directory if it exists
     - do not replace /dev/null when running in APT::CDROM::NoAct
       mode (LP: #612666), thanks to Colin Watson
+  * apt-pkg/contrib/cdromutl.cc:
+    - if apt-cdrom is used on writable media (like usb-sticks), do
+      not use the root directory to identify the medium (as all 
+      changes there change the ident id). Use the .disk directory 
+      instead 
 
  -- Michael Vogt <michael.vogt@ubuntu.com>  Fri, 03 Sep 2010 20:21:43 +0200