Dracut regenerate initrd w/ the right kernel

When picking the latest version of the kernel on i386 we should prioritize
PAE kernels. Debug kernels will be ignored.

Change-Id: Ic0fc5907074ee2a5ddfbbb1db2f1c8a6060cae9f
Related-Bug: #1240873
This commit is contained in:
Lucas Alvares Gomes 2013-10-17 12:11:30 +01:00
parent d23ba2a8a8
commit f707a6bd82

View File

@ -1,6 +1,15 @@
#!/bin/bash
LAST_VERSION=$(basename `ls -1 /boot/vmlinuz* | tail -1 | sed 's/vmlinuz-//g'`)
INITRAMFS=`ls /boot/initramfs-$LAST_VERSION.img`
# Prioritize PAE if present
KERNEL=$(basename `ls -1rv /boot/vmlinuz* | grep PAE | grep -v debug | head -1`)
if [ ! $KERNEL ]; then
KERNEL=$(basename `ls -1rv /boot/vmlinuz* | grep -v debug | head -1`)
if [ ! $KERNEL ]; then
echo "No suitable kernel found."
exit 1
fi
fi
KERNEL_VERSION=`echo $KERNEL | sed 's/vmlinuz-//g'`
RAMDISK=/boot/initramfs-$KERNEL_VERSION.img
dracut --force --add "network" $INITRAMFS $LAST_VERSION
dracut --force --add "network" $RAMDISK $KERNEL_VERSION