summaryrefslogtreecommitdiff
path: root/methods/cdrom.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-01-26 12:00:40 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2010-01-26 12:00:40 +0100
commit972c339a1b05671e3f01b46cece3b323a2a94d61 (patch)
tree91a706a1c6c3b6b42b0cc469d413475eb4b2c2c4 /methods/cdrom.cc
parenta29b2c0b9c4e7b1c36433c9c6dd5d24697f9c4b6 (diff)
parentff1e4b0626d8ce567492ccadbd30dfc32d4c15f1 (diff)
* cmdline/apt-get.cc:
- fix apt-get source pkg=version regression (closes: #561971) * apt-pkg/contrib/cdromutl.cc: - fix UnmountCdrom() fails, give it a bit more time and try the umount again * methods/cdrom.cc: - fixes in multi cdrom setup code - add new "Acquire::cdrom::AutoDetect" variable that enables/disables the dlopen of libudev for automatic cdrom detection
Diffstat (limited to 'methods/cdrom.cc')
-rw-r--r--methods/cdrom.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/methods/cdrom.cc b/methods/cdrom.cc
index 9802eb46c..87794b052 100644
--- a/methods/cdrom.cc
+++ b/methods/cdrom.cc
@@ -37,8 +37,8 @@ class CDROMMethod : public pkgAcqMethod
bool MountedByApt;
pkgUdevCdromDevices UdevCdroms;
- bool IsCorrectCD(URI want, string MountPath);
- bool AutoDetectAndMount(URI);
+ bool IsCorrectCD(URI want, string MountPath, string& NewID);
+ bool AutoDetectAndMount(URI, string &NewID);
virtual bool Fetch(FetchItem *Itm);
string GetID(string Name);
virtual void Exit();
@@ -92,7 +92,7 @@ string CDROMMethod::GetID(string Name)
// CDROMMethod::AutoDetectAndMount /*{{{*/
// ---------------------------------------------------------------------
/* Modifies class varaiable CDROM to the mountpoint */
-bool CDROMMethod::AutoDetectAndMount(URI Get)
+bool CDROMMethod::AutoDetectAndMount(URI Get, string NewID)
{
vector<struct CdromDevice> v = UdevCdroms.Scan();
@@ -103,7 +103,7 @@ bool CDROMMethod::AutoDetectAndMount(URI Get)
{
if (Debug)
clog << "Checking mounted cdrom device " << v[i].DeviceName << endl;
- if (IsCorrectCD(Get, v[i].MountPath))
+ if (IsCorrectCD(Get, v[i].MountPath, NewID))
{
CDROM = v[i].MountPath;
return true;
@@ -126,7 +126,7 @@ bool CDROMMethod::AutoDetectAndMount(URI Get)
{
if(MountCdrom("/media/apt", v[i].DeviceName))
{
- if (IsCorrectCD(Get, "/media/apt"))
+ if (IsCorrectCD(Get, "/media/apt", NewID))
{
MountedByApt = true;
CDROM = "/media/apt";
@@ -144,10 +144,8 @@ bool CDROMMethod::AutoDetectAndMount(URI Get)
// CDROMMethod::IsCorrectCD /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool CDROMMethod::IsCorrectCD(URI want, string MountPath)
+bool CDROMMethod::IsCorrectCD(URI want, string MountPath, string& NewID)
{
- string NewID;
-
for (unsigned int Version = 2; Version != 0; Version--)
{
if (IdentCdrom(MountPath,NewID,Version) == false)
@@ -220,23 +218,24 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
return true;
}
+ bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true);
CDROM = _config->FindDir("Acquire::cdrom::mount","/cdrom/");
if (Debug)
clog << "Looking for CDROM at " << CDROM << endl;
if (CDROM[0] == '.')
CDROM= SafeGetCWD() + '/' + CDROM;
- string NewID;
+ string NewID;
while (CurrentID.empty() == true)
{
- if (CDROM == "apt-udev-auto/")
- AutoDetectAndMount(Get);
+ if (AutoDetect)
+ AutoDetectAndMount(Get, NewID);
if(!IsMounted(CDROM))
MountedByApt = MountCdrom(CDROM);
- if (IsCorrectCD(Get, CDROM))
+ if (IsCorrectCD(Get, CDROM, NewID))
break;
// I suppose this should prompt somehow?