- // hrm, ugly the loop here
- if (CDROM == "apt-udev-auto/")
- {
- if(udev.Dlopen())
- {
- vector<struct CdromDevice> v = udev.Scan();
- for (unsigned int i=0; i < v.size(); i++)
- {
- if (Debug)
- clog << "Have cdrom device " << v[i].DeviceName << endl;
- if (!v[i].Mounted)
- {
- if (!FileExists("/media/apt"))
- mkdir("/media/apt", 0755);
- if(MountCdrom("/media/apt", v[i].DeviceName))
- {
- if (IsCorrectCD(Get, "/media/apt"))
- {
- MountedByApt = true;
- CDROM = "/media/apt";
- break;
- } else {
- UnmountCdrom("/media/apt");
- }
- }
- } else {
- if (IsCorrectCD(Get, v[i].MountPath))
- {
- CDROM = v[i].MountPath;
- break;
- }
- }
- }
- } else {
- _error->WarningE("udev.Dlopen() failed","foo");
- }
- }