Fix disk-image-get-kernel for redhat
disk-image-get-kernel picks the wrong version of kernel and initramfs if there's a PAE and non-PAE version present. Only affects i386 images. Change-Id: I06e08fdf038988759b620f549261499cb0a69b34 Closes-Bug: #1240873
This commit is contained in:
parent
d23ba2a8a8
commit
0210be22ae
@ -85,8 +85,25 @@ BOOTDIR="$WORK_DIR/boot"
|
|||||||
KERNEL=
|
KERNEL=
|
||||||
RAMDISK=
|
RAMDISK=
|
||||||
if [ -f $WORK_DIR/etc/redhat-release ]; then
|
if [ -f $WORK_DIR/etc/redhat-release ]; then
|
||||||
KERNEL=$(basename `ls -1rv $BOOTDIR/vmlinuz* | head -1`)
|
|
||||||
RAMDISK=$(basename `ls -1rv $BOOTDIR/initramfs* | head -1`)
|
# Prioritize PAE if present
|
||||||
|
KERNEL=$(basename `ls -1rv $BOOTDIR/vmlinuz* | grep PAE | grep -v debug | head -1`)
|
||||||
|
if [ ! $KERNEL ]; then
|
||||||
|
KERNEL=$(basename `ls -1rv $BOOTDIR/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=$(basename `ls $BOOTDIR/initramfs-$KERNEL_VERSION.img`)
|
||||||
|
if [ ! $RAMDISK ]; then
|
||||||
|
echo "Can't find an initramfs for the $KERNEL_VERSION version of the kernel."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
elif [ -f $WORK_DIR/etc/debian_version ]; then
|
elif [ -f $WORK_DIR/etc/debian_version ]; then
|
||||||
KERNEL=$(basename `ls -1rv $BOOTDIR/vmlinuz*generic | head -1`)
|
KERNEL=$(basename `ls -1rv $BOOTDIR/vmlinuz*generic | head -1`)
|
||||||
RAMDISK=$(basename `ls -1rv $BOOTDIR/initrd*generic | head -1`)
|
RAMDISK=$(basename `ls -1rv $BOOTDIR/initrd*generic | head -1`)
|
||||||
|
Loading…
Reference in New Issue
Block a user