summaryrefslogtreecommitdiffstats
path: root/booty/util.py
diff options
context:
space:
mode:
authorDavid Lehman <dlehman@redhat.com>2009-03-05 08:56:02 -0600
committerDavid Lehman <dlehman@redhat.com>2009-03-05 08:56:42 -0600
commitbb6b3a050d0a007cea27bdd716280c19bb104071 (patch)
tree966ebfd209456cf1d288ecf14286bb30881d6697 /booty/util.py
parent100611e0201cc19668ca8f642dd5bc437d2749ba (diff)
downloadanaconda-bb6b3a050d0a007cea27bdd716280c19bb104071.tar.gz
anaconda-bb6b3a050d0a007cea27bdd716280c19bb104071.tar.xz
anaconda-bb6b3a050d0a007cea27bdd716280c19bb104071.zip
Stop with the fsset usage.
Diffstat (limited to 'booty/util.py')
-rw-r--r--booty/util.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/booty/util.py b/booty/util.py
new file mode 100644
index 000000000..f9a1b3e84
--- /dev/null
+++ b/booty/util.py
@@ -0,0 +1,33 @@
+import string
+
+def getDiskPart(dev):
+ cut = len(dev)
+ if (dev.startswith('rd/') or dev.startswith('ida/') or
+ dev.startswith('cciss/') or dev.startswith('sx8/') or
+ dev.startswith('mapper/') or dev.startswith('mmcblk')):
+ if dev[-2] == 'p':
+ cut = -1
+ elif dev[-3] == 'p':
+ cut = -2
+ else:
+ if dev[-2] in string.digits:
+ cut = -2
+ elif dev[-1] in string.digits:
+ cut = -1
+
+ name = dev[:cut]
+
+ # hack off the trailing 'p' from /dev/cciss/*, for example
+ if name[-1] == 'p':
+ for letter in name:
+ if letter not in string.letters and letter != "/":
+ name = name[:-1]
+ break
+
+ if cut < 0:
+ partNum = int(dev[cut:]) - 1
+ else:
+ partNum = None
+
+ return (name, partNum)
+