From 2a001232db431d995281c2bead32ed9423721447 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 10 Sep 2010 12:21:06 +0200 Subject: * 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 --- apt-pkg/contrib/cdromutl.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc index 6dce82fe1..129e4a9f6 100644 --- a/apt-pkg/contrib/cdromutl.cc +++ b/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()); -- cgit v1.2.3