summaryrefslogtreecommitdiffstats
path: root/fsset.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2001-07-11 01:59:24 +0000
committerJeremy Katz <katzj@redhat.com>2001-07-11 01:59:24 +0000
commita7bab3f6865cc2ffcfe36c855145976bbbb6200a (patch)
tree90011d9fb12a5306faadcb6d834d1e4393f3abb1 /fsset.py
parent3f3a0483d9a72a5a1111fd3bf6b1ec318aaf0201 (diff)
downloadanaconda-a7bab3f6865cc2ffcfe36c855145976bbbb6200a.tar.gz
anaconda-a7bab3f6865cc2ffcfe36c855145976bbbb6200a.tar.xz
anaconda-a7bab3f6865cc2ffcfe36c855145976bbbb6200a.zip
badblocks support -- have to do this before even formatting swap as they
might want to check their swap for badblocks. also, still needs to parse the output and have a progress bar post-beta 2
Diffstat (limited to 'fsset.py')
-rw-r--r--fsset.py41
1 files changed, 40 insertions, 1 deletions
diff --git a/fsset.py b/fsset.py
index be82d7c06..73c953778 100644
--- a/fsset.py
+++ b/fsset.py
@@ -130,6 +130,16 @@ class FileSystemType:
def registerDeviceArgumentFunction(self, klass, function):
self.deviceArguments[klass] = function
+ def badblocksDevice(self, entry, progress, chroot='/'):
+ devicePath = entry.device.setupDevice(chroot)
+ args = [ "badblocks", "-vv", devicePath ]
+
+ rc = iutil.execWithRedirect("/usr/sbin/badblocks", args,
+ stdout = "/dev/tty5",
+ stderr = "/dev/tty5")
+ if rc:
+ raise SystemError
+
def formatDevice(self, devicePath, device, progress, chroot='/'):
if self.isFormattable():
raise RuntimeError, "formatDevice method not defined"
@@ -635,6 +645,9 @@ class FileSystemSet:
def formatEntry(self, entry, chroot):
entry.fsystem.formatDevice(entry, self.progressWindow, chroot)
+
+ def badblocksEntry(self, entry, chroot):
+ entry.fsystem.badblocksDevice(entry, self.progressWindow, chroot)
def formattablePartitions(self):
list = []
@@ -643,6 +656,24 @@ class FileSystemSet:
list.append (entry)
return list
+ def checkBadblocks(self, chroot='/'):
+ for entry in self.entries:
+ if (not entry.fsystem.isFormattable() or not entry.getBadblocks()
+ or entry.isMounted()):
+ continue
+ try:
+ self.badblocksEntry(entry, chroot)
+ except SystemError:
+ if self.messageWindow:
+ self.messageWindow(_("Error"),
+ _("An error occurred searching for "
+ "bad blocks on %s. This problem is "
+ "serious, and the install cannot "
+ "continue.\n\n"
+ "Press Enter to reboot your system.")
+ % (entry.device.getDevice(),))
+ sys.exit(0)
+
def makeFilesystems (self, chroot='/'):
for entry in self.entries:
if (not entry.fsystem.isFormattable() or not entry.getFormat()
@@ -766,7 +797,8 @@ class FileSystemSetEntry:
def __init__ (self, device, mountpoint,
fsystem=None, options=None,
origfsystem=None, migrate=0,
- order=-1, fsck=-1, format=0):
+ order=-1, fsck=-1, format=0,
+ badblocks = 0):
if not fsystem:
fsystem = fileSystemTypeGet("ext2")
self.device = device
@@ -798,6 +830,7 @@ class FileSystemSetEntry:
"but has been added to fsset with format "
"flag on" % fsystem.getName())
self.format = format
+ self.badblocks = badblocks
def mount(self, chroot='/', devPrefix='/tmp'):
device = self.device.setupDevice(chroot, devPrefix=devPrefix)
@@ -809,6 +842,12 @@ class FileSystemSetEntry:
self.fsystem.umount(self.device, "%s/%s" % (chroot,
self.mountpoint))
self.mountcount = self.mountcount - 1
+
+ def setBadblocks(self, state):
+ self.badblocks = state
+
+ def getBadblocks(self):
+ return self.badblocks
def setFormat (self, state):
if self.migrate: