X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/f4c4a24ea1cd8711c186c1c60b43f0bf0bc8af10..d4f626ff09383873c7b1ae42b744293c940c9c2c:/apt-pkg/cdrom.cc diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index deca6b4ac..36a1d7f12 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -854,7 +854,9 @@ pkgUdevCdromDevices::Dlopen() /*{{{*/ libudev_handle = h; udev_new = (udev* (*)(void)) dlsym(h, "udev_new"); udev_enumerate_add_match_property = (int (*)(udev_enumerate*, const char*, const char*))dlsym(h, "udev_enumerate_add_match_property"); +#if 0 // FIXME: uncomment on next ABI break udev_enumerate_add_match_sysattr = (int (*)(udev_enumerate*, const char*, const char*))dlsym(h, "udev_enumerate_add_match_sysattr"); +#endif udev_enumerate_scan_devices = (int (*)(udev_enumerate*))dlsym(h, "udev_enumerate_scan_devices"); udev_enumerate_get_list_entry = (udev_list_entry* (*)(udev_enumerate*))dlsym(h, "udev_enumerate_get_list_entry"); udev_device_new_from_syspath = (udev_device* (*)(udev*, const char*))dlsym(h, "udev_device_new_from_syspath"); @@ -875,7 +877,8 @@ pkgUdevCdromDevices::Dlopen() /*{{{*/ vector pkgUdevCdromDevices::Scan() { - return ScanForRemovable(true); + bool CdromOnly = _config->FindB("APT::cdrom::CdromOnly", true); + return ScanForRemovable(CdromOnly); }; /*}}}*/ /*{{{*/ @@ -894,8 +897,13 @@ pkgUdevCdromDevices::ScanForRemovable(bool CdromOnly) enumerate = udev_enumerate_new (udev_ctx); if (CdromOnly) udev_enumerate_add_match_property(enumerate, "ID_CDROM", "1"); - else + else { +#if 1 // FIXME: remove the next two lines on the next ABI break + int (*udev_enumerate_add_match_sysattr)(struct udev_enumerate *udev_enumerate, const char *property, const char *value); + udev_enumerate_add_match_sysattr = (int (*)(udev_enumerate*, const char*, const char*))dlsym(libudev_handle, "udev_enumerate_add_match_sysattr"); +#endif udev_enumerate_add_match_sysattr(enumerate, "removable", "1"); + } udev_enumerate_scan_devices (enumerate); devices = udev_enumerate_get_list_entry (enumerate); @@ -907,13 +915,18 @@ pkgUdevCdromDevices::ScanForRemovable(bool CdromOnly) if (udevice == NULL) continue; const char* devnode = udev_device_get_devnode(udevice); - const char* mountpath = udev_device_get_property_value(udevice, "FSTAB_DIR"); - if (mountpath == NULL) + + // try fstab_dir first + string mountpath; + const char* mp = udev_device_get_property_value(udevice, "FSTAB_DIR"); + if (mp) + mountpath = string(mp); + else mountpath = FindMountPointForDevice(devnode); // fill in the struct cdrom.DeviceName = string(devnode); - if (mountpath) { + if (mountpath != "") { cdrom.MountPath = mountpath; string s = string(mountpath); cdrom.Mounted = IsMounted(s);