diff options
author | Jeremy Katz <katzj@redhat.com> | 2002-08-22 05:28:54 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2002-08-22 05:28:54 +0000 |
commit | 6a69167764b18ebc8f3461cded7eddbdaeac8882 (patch) | |
tree | 95ea9c273676e03605ffac0d3b53e254b1618edb /floppy.py | |
parent | 7d32a93439083847974db12b3166077a9cd72d62 (diff) | |
download | anaconda-6a69167764b18ebc8f3461cded7eddbdaeac8882.tar.gz anaconda-6a69167764b18ebc8f3461cded7eddbdaeac8882.tar.xz anaconda-6a69167764b18ebc8f3461cded7eddbdaeac8882.zip |
check the size of the kernel and initrd. if it's going to be bigger than
a floppy, tell the user that it's not going to fit
Diffstat (limited to 'floppy.py')
-rw-r--r-- | floppy.py | 48 |
1 files changed, 43 insertions, 5 deletions
@@ -17,7 +17,7 @@ import isys import errno import iutil import re -import os +import os, stat import rpm404 as rpm import kudzu from constants import * @@ -56,6 +56,48 @@ def makeBootdisk (intf, dir, floppyDevice, hdList, instPath, bootloader): if flags.test: return DISPATCH_NOOP + kernel = hdList['kernel'] + kernelTag = "-%s-%s" % (kernel[rpm.RPMTAG_VERSION], + kernel[rpm.RPMTAG_RELEASE]) + + + # FIXME: if other arches had working boot disks, we wouldn't be able + # to hardcode /boot + kernel = "%s/boot/vmlinuz%s" %(instPath, kernelTag) + size = 0 + if os.access(kernel, os.R_OK): + try: + kernelsize = os.stat(kernel)[stat.ST_SIZE] + log("kernelsize is %s" %(kernelsize,)) + except: + kernelsize = 0 + size = size + kernelsize + + initrd = "%s/boot/initrd%s.img" %(instPath, kernelTag) + if os.access(initrd, os.R_OK): + try: + initrdsize = os.stat(initrd)[stat.ST_SIZE] + log("initrdsize is %s" %(initrdsize,) ) + except: + initrdsize = 0 + size = size + initrdsize + + log("boot floppy size is %s" %(size,)) + + # go within 10 K of the size of the boot disk to have a tad + # bit of safety. if this fails, we're no worse off than we used + # to be. + if size >= 1416 * 1024 * 1024: + intf.messageWindow(_("Unable to make boot floppy"), + _("The size of the kernel modules needed " + "for your machine make it impossible to " + "create a boot disk that will fit on a " + "floppy diskette."), + type = "warning") + return DISPATCH_NOOP + + + rc = intf.messageWindow( _("Insert a floppy disk"), _("Please remove any diskettes from the floppy " "drive, and insert the floppy diskette that " @@ -80,10 +122,6 @@ def makeBootdisk (intf, dir, floppyDevice, hdList, instPath, bootloader): return DISPATCH_BACK os.close(fd) - kernel = hdList['kernel'] - kernelTag = "-%s-%s" % (kernel[rpm.RPMTAG_VERSION], - kernel[rpm.RPMTAG_RELEASE]) - if bootloader.args.get(): args = bootloader.args.get() else: |