summaryrefslogtreecommitdiffstats
path: root/command-stubs
diff options
context:
space:
mode:
authorMike Fulbright <msf@redhat.com>2002-08-16 05:05:54 +0000
committerMike Fulbright <msf@redhat.com>2002-08-16 05:05:54 +0000
commitbd57de1982720739b66abea1e312946aea94be05 (patch)
tree69cc4ece019babd5cb3dfbcef28100d973894342 /command-stubs
parentafa86a478c67bff7ae76084420ef702d383db36f (diff)
downloadanaconda-bd57de1982720739b66abea1e312946aea94be05.tar.gz
anaconda-bd57de1982720739b66abea1e312946aea94be05.tar.xz
anaconda-bd57de1982720739b66abea1e312946aea94be05.zip
simple script to scan and list harddrives for use in kickstart
Diffstat (limited to 'command-stubs')
-rwxr-xr-xcommand-stubs/list-harddrives-stub37
1 files changed, 37 insertions, 0 deletions
diff --git a/command-stubs/list-harddrives-stub b/command-stubs/list-harddrives-stub
new file mode 100755
index 000000000..cd53689f7
--- /dev/null
+++ b/command-stubs/list-harddrives-stub
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+#
+# scan system for harddrives and output device name/size
+#
+
+import parted
+import partedUtils
+import isys
+import os
+
+drives = isys.hardDriveDict()
+
+driveList = drives.keys()
+driveList.sort()
+for drive in driveList:
+
+ if isys.driveIsRemovable(drive):
+ continue
+
+ # try to open and get size
+ skip = 0
+ deviceFile = "/tmp/%s" % (drive,)
+ isys.makeDevInode(drive, deviceFile)
+ try:
+ dev = parted.PedDevice.get(deviceFile)
+ except:
+ skip = 1
+ os.remove(deviceFile)
+
+ if skip:
+ continue
+
+ sizeMB = (float(dev.heads * dev.cylinders * dev.sectors) / (1024 * 1024)
+ * dev.sector_size)
+
+ print drive, sizeMB
+