From: Mark Huang Date: Thu, 22 Sep 2005 22:27:43 +0000 (+0000) Subject: - read the primary kernel version from the /boot/initrd-boot symlink, X-Git-Tag: bootmanager-3_1_9~5 X-Git-Url: http://git.onelab.eu/?p=bootmanager.git;a=commitdiff_plain;h=9b48aff4ca2a43a2e06bcc4a0b9ad7b7aa17e482 - read the primary kernel version from the /boot/initrd-boot symlink, rather than the first entry in /lib/modules - ...thus building the initrd for the correct kernel, in case there are orphaned modules in /lib/modules installed by, say, vnet --- diff --git a/source/steps/InstallWriteConfig.py b/source/steps/InstallWriteConfig.py index d7fddcc..45c7156 100644 --- a/source/steps/InstallWriteConfig.py +++ b/source/steps/InstallWriteConfig.py @@ -154,8 +154,12 @@ def Run( vars, log ): # boot cd. log.write( "Writing /etc/modprobe.conf\n" ) + # get the kernel version + initrd= os.readlink( "%s/boot/initrd-boot" % SYSIMG_PATH ) + kernel_version= initrd.replace("initrd-", "").replace(".img", "") + sysinfo= systeminfo() - sysmods= sysinfo.get_system_modules(SYSIMG_PATH) + sysmods= sysinfo.get_system_modules(SYSIMG_PATH, kernel_version) if sysmods is None: raise BootManagerException, "Unable to get list of system modules." @@ -256,11 +260,10 @@ def Run( vars, log ): rootdev= file( "%s/%s" % (SYSIMG_PATH,PARTITIONS["mapper-root"]), "w" ) rootdev.close() - utils.sysexec( "chroot %s sh -c '" \ - "kernelversion=`ls /lib/modules | tail -1` && " \ - "rm -f /boot/initrd-$kernelversion.img && " \ - "mkinitrd /boot/initrd-$kernelversion.img $kernelversion'" % \ - SYSIMG_PATH, log ) + # initrd set above + utils.removefile( "%s/boot/%s" % (SYSIMG_PATH, initrd) ) + utils.sysexec( "chroot %s mkinitrd /boot/initrd-%s.img %s" % \ + (SYSIMG_PATH, kernel_version, kernel_version), log ) if fake_root_lvm == 1: utils.removefile( "%s/%s" % (SYSIMG_PATH,PARTITIONS["mapper-root"]) )