diff options
author | Chris Lumens <clumens@redhat.com> | 2009-08-03 15:16:32 -0400 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2009-08-04 10:41:16 -0400 |
commit | 86b25083c61c583c866c8bbb93c18cf3c8f57804 (patch) | |
tree | 715fc5726c11f5b57da40b08d0a34425f2edbf8d | |
parent | 7957c749d80d45b1e3375ffe1b4e172d37241a10 (diff) | |
download | anaconda-86b25083c61c583c866c8bbb93c18cf3c8f57804.tar.gz anaconda-86b25083c61c583c866c8bbb93c18cf3c8f57804.tar.xz anaconda-86b25083c61c583c866c8bbb93c18cf3c8f57804.zip |
No longer use HAL in list-harddrives.
-rwxr-xr-x | command-stubs/list-harddrives-stub | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/command-stubs/list-harddrives-stub b/command-stubs/list-harddrives-stub index a8060b15b..ae7e31dba 100755 --- a/command-stubs/list-harddrives-stub +++ b/command-stubs/list-harddrives-stub @@ -18,43 +18,17 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -import dbus import sys - -HAL_INTERFACE = "org.freedesktop.Hal" -HAL_MANAGER_PATH = "/org/freedesktop/Hal/Manager" -HAL_MANAGER_INTERFACE = "org.freedesktop.Hal.Manager" -HAL_DEVICE_INTERFACE = "org.freedesktop.Hal.Device" +import parted def main(argv): lst = set() - try: - bus = dbus.SystemBus() - hal = dbus.Interface(bus.get_object(HAL_INTERFACE, - HAL_MANAGER_PATH), - HAL_MANAGER_INTERFACE) - except: - sys.exit(1) - - for udi in hal.FindDeviceByCapability("volume"): - try: - haldev = dbus.Interface(bus.get_object(HAL_INTERFACE, udi), - HAL_DEVICE_INTERFACE) - props = haldev.GetAllProperties() - except dbus.exceptions.DBusException: - continue - - if not props.has_key('volume.size'): - continue - - size = str(props['volume.size'] / (1024 * 1024)) - if props.has_key('block.device'): - devnode = props['block.device'].encode('utf-8') - elif props.has_key('linux.device_file'): - devnode = props['linux.device_file'].encode('utf-8') + for dev in filter(lambda d: d.type <= parted.DEVICE_SX8, parted.getAllDevices()): + disk = parted.Disk(dev) - lst.add("%s %s" % (devnode, size,)) + for part in disk.partitions: + lst.add("%s %s" % (part.path, int(part.getSize()))) lst = list(lst) lst.sort() |