From 0eaddbd214fa03f2a4a4041686c7ca62a21e4941 Mon Sep 17 00:00:00 2001
From: Jan Provaznik <jprovazn@redhat.com>
Date: Thu, 12 Sep 2013 11:26:57 +0200
Subject: [PATCH 3/5] 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
---
bin/disk-image-get-kernel | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/bin/disk-image-get-kernel b/bin/disk-image-get-kernel
index 3c2679c..ac631ee 100755
--- a/bin/disk-image-get-kernel
+++ b/bin/disk-image-get-kernel
@@ -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
--
1.8.1.4