summaryrefslogtreecommitdiffstats
path: root/partedUtils.py
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2003-01-10 05:03:18 +0000
committerMatt Wilson <msw@redhat.com>2003-01-10 05:03:18 +0000
commitf12cc91ff9f7e2b2add49072bd25cc6e28eaa08e (patch)
tree2f6d104d79be5ff43a33efe476508fb78f013825 /partedUtils.py
parentc803b8a8e3b73e6312dbd215e551a6cc516eeb71 (diff)
downloadanaconda-f12cc91ff9f7e2b2add49072bd25cc6e28eaa08e.tar.gz
anaconda-f12cc91ff9f7e2b2add49072bd25cc6e28eaa08e.tar.xz
anaconda-f12cc91ff9f7e2b2add49072bd25cc6e28eaa08e.zip
handle multiple filesystem signatures - needs parted binding work
Diffstat (limited to 'partedUtils.py')
-rw-r--r--partedUtils.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/partedUtils.py b/partedUtils.py
index 10df57f7e..1eb8cbe5c 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -260,6 +260,38 @@ def checkDiskLabel(disk, intf):
else:
return 1
+# attempt to associate a parted filesystem type on a partition that
+# didn't probe as one type or another.
+def validateFsType(part):
+ # we only care about primary and logical partitions
+ if not part.type in (parted.PARTITION_PRIMARY,
+ parted.PARTITION_LOGICAL):
+ return
+ # if the partition already has a type, no need to search
+ if part.fs_type:
+ return
+
+ # first fsystem to probe wins, so sort the types into a preferred
+ # order.
+ fsnames = fsTypes.keys()
+ goodTypes = ['ext3', 'ext2']
+ badTypes = ['linux-swap',]
+ for fstype in goodTypes:
+ fsnames.remove(fstype)
+ fsnames = goodTypes + fsnames
+ for fstype in badTypes:
+ fsnames.remove(fstype)
+ fsnames.extend(badTypes)
+
+ # now check each type, and set the partition system accordingly.
+ for fsname in fsnames:
+ fstype = fsTypes[fsname]
+ if fstype.probe_specific(part.geom) != None:
+ # XXX verify that this will not modify system type
+ # in the case where a user does not modify partitions
+ part.set_system(fstype)
+ return
+
def isLinuxNativeByNumtype(numtype):
"""Check if the type is a 'Linux native' filesystem."""
linuxtypes = [0x82, 0x83, 0x8e, 0xfd]
@@ -732,6 +764,9 @@ class DiskSet:
DiskSet.skippedDisks.append(drive)
continue
+ # MSWFIXME: enable once parted binding complete
+ # filter_partitions(disk, validateFsType)
+
# check that their partition table is valid for their architecture
ret = checkDiskLabel(disk, intf)
if ret == 1: