summaryrefslogtreecommitdiffstats
path: root/fsset.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2002-06-06 21:54:09 +0000
committerJeremy Katz <katzj@redhat.com>2002-06-06 21:54:09 +0000
commitfcba9b43ab1249840ec2b7dd8097145d55d39aaf (patch)
tree68103f16fb19ebb1939563301aa36679316eec68 /fsset.py
parentae97caf371ec4d60362199ab28d76e943482d64a (diff)
downloadanaconda-fcba9b43ab1249840ec2b7dd8097145d55d39aaf.tar.gz
anaconda-fcba9b43ab1249840ec2b7dd8097145d55d39aaf.tar.xz
anaconda-fcba9b43ab1249840ec2b7dd8097145d55d39aaf.zip
start reading in preexisting volume group information and logical volumes
Diffstat (limited to 'fsset.py')
-rw-r--r--fsset.py35
1 files changed, 24 insertions, 11 deletions
diff --git a/fsset.py b/fsset.py
index dd85dd2be..4267457d6 100644
--- a/fsset.py
+++ b/fsset.py
@@ -1813,13 +1813,23 @@ def readFstab (path):
fsset.add(entry)
return fsset
-def isValidExt2(device):
- file = '/tmp/' + device
- isys.makeDevInode(device, file)
+def getDevFD(device):
try:
- fd = os.open(file, os.O_RDONLY)
+ fd = os.open(device, os.O_RDONLY)
except:
- return 0
+ file = '/tmp/' + device
+ isys.makeDevInode(device, file)
+ try:
+ fd = os.open(file, os.O_RDONLY)
+ except:
+ return -1
+ return fd
+
+
+def isValidExt2(device):
+ fd = getDevFD(device)
+ if fd == -1:
+ return 0
buf = os.read(fd, 2048)
os.close(fd)
@@ -1833,11 +1843,8 @@ def isValidExt2(device):
return 0
def isValidXFS(device):
- file = '/tmp/' + device
- isys.makeDevInode(device, file)
- try:
- fd = os.open(file, os.O_RDONLY)
- except:
+ fd = getDevFD(device)
+ if fd == -1:
return 0
buf = os.read(fd, 4)
@@ -1860,10 +1867,16 @@ def getFStoTry(device):
rc.append("xfs")
if isValidExt2(device):
- if isys.ext2HasJournal(device):
+ if os.access(device, os.O_RDONLY):
+ create = 0
+ else:
+ create = 1
+ if isys.ext2HasJournal(device, makeDevNode = create):
rc.append("ext3")
rc.append("ext2")
+ # FIXME: need to check for swap
+
# XXX check for reiserfs signature, jfs signature, and others ?
return rc