summaryrefslogtreecommitdiffstats
path: root/floppy.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2003-01-03 06:00:55 +0000
committerJeremy Katz <katzj@redhat.com>2003-01-03 06:00:55 +0000
commit310f5c3faa37debd52785d94216bfddbf6e78873 (patch)
tree213e665aeed090355a5f991197fa6e0fbc4c5c17 /floppy.py
parente55e6c50f645a947bf09049c224121b3f8e9666b (diff)
downloadanaconda-310f5c3faa37debd52785d94216bfddbf6e78873.tar.gz
anaconda-310f5c3faa37debd52785d94216bfddbf6e78873.tar.xz
anaconda-310f5c3faa37debd52785d94216bfddbf6e78873.zip
add some verification to ensure that the floppy disk we wrote out has
an initrd and kernel of the same size as when we started. if not, yell
Diffstat (limited to 'floppy.py')
-rw-r--r--floppy.py53
1 files changed, 50 insertions, 3 deletions
diff --git a/floppy.py b/floppy.py
index 2baaeeadd..72d660dbb 100644
--- a/floppy.py
+++ b/floppy.py
@@ -110,10 +110,9 @@ def makeBootdisk (intf, dir, floppyDevice, hdList, instPath, bootloader):
# this is faster then waiting on mkbootdisk to fail
device = floppyDevice
- file = "/tmp/floppy"
- isys.makeDevInode(device, file)
+ isys.makeDevInode(device, "/tmp/floppy")
try:
- fd = os.open(file, os.O_RDONLY)
+ fd = os.open("/tmp/floppy", os.O_RDONLY)
except:
intf.messageWindow( _("Error"),
_("An error occurred while making the boot disk. "
@@ -145,4 +144,52 @@ def makeBootdisk (intf, dir, floppyDevice, hdList, instPath, bootloader):
"Please make sure that there is a floppy "
"in the first floppy drive."))
return DISPATCH_BACK
+
+
+ # more sanity checking -- see if the initrd size and kernel size
+ # match what we thought they would be
+ device = floppyDevice
+ file = "/tmp/floppy"
+ isys.makeDevInode(device, file)
+ try:
+ isys.mount("/tmp/floppy", "/mnt/floppy", "vfat")
+ except:
+ intf.messageWindow(_("Error"),
+ _("An error occurred while attempting to verify "
+ "the boot disk. Please make sure that you "
+ "have a good floppy in the first floppy drive."))
+ return DISPATCH_BACK
+
+ problem = 0
+ if os.access("/mnt/floppy/vmlinuz", os.R_OK):
+ if kernelsize != 0:
+ size = os.stat("/mnt/floppy/vmlinuz")[stat.ST_SIZE]
+ if size != kernelsize:
+ problem = 1
+ else:
+ log("unable to verify kernel size. hope it fit!")
+ else:
+ problem = 1
+
+ if initrdsize != 0:
+ if os.access("/mnt/floppy/initrd.img", os.R_OK):
+ size = os.stat("/mnt/floppy/initrd.img")[stat.ST_SIZE]
+ if size != initrdsize:
+ problem = 1
+ else:
+ problem = 1
+
+ try:
+ isys.umount("/mnt/floppy")
+ except:
+ pass
+
+ if problem == 1:
+ intf.messageWindow(_("Error"),
+ _("Your boot floppy appears to be invalid. This "
+ "is likely due to a bad floppy. Please make "
+ "sure that you have a good floppy in the "
+ "first floppy drive."))
+ return DISPATCH_BACK
+
return DISPATCH_FORWARD