Fixes files ordering when choosing newest image

For example if there are following kernels in undercloud/overcloud
image:
/boot/vmlinuz-3.9.5-301.fc19.i686.PAE
/boot/vmlinuz-3.10.10-200.fc19.i686.PAE
then disk-image-get-kernel picks vmlinuz-3.9.5. It should use the
newest one.

Change-Id: I7bbf06705e85370d66c7dd8a5d4f8d6c93b21c0c
Fixes: bug #1224365
This commit is contained in:
Jan Provaznik 2013-09-12 11:26:57 +02:00
parent 43b96d91c2
commit 0eaddbd214

View File

@ -85,11 +85,11 @@ BOOTDIR="$WORK_DIR/boot"
KERNEL=
RAMDISK=
if [ -f $WORK_DIR/etc/redhat-release ]; then
KERNEL=$(basename `ls -1 $BOOTDIR/vmlinuz* | sort -n | tail -1`)
RAMDISK=$(basename `ls -1 $BOOTDIR/initramfs* | sort -n | tail -1`)
KERNEL=$(basename `ls -1rv $BOOTDIR/vmlinuz* | head -1`)
RAMDISK=$(basename `ls -1rv $BOOTDIR/initramfs* | head -1`)
elif [ -f $WORK_DIR/etc/debian_version ]; then
KERNEL=$(basename `ls -1 $BOOTDIR/vmlinuz*generic | sort -n | tail -1`)
RAMDISK=$(basename `ls -1 $BOOTDIR/initrd*generic | sort -n | tail -1`)
KERNEL=$(basename `ls -1rv $BOOTDIR/vmlinuz*generic | head -1`)
RAMDISK=$(basename `ls -1rv $BOOTDIR/initrd*generic | head -1`)
else
echo "ERROR: Unable to detect operating system"
exit 1