From 237fd64b477722f32fd6b2edd0e1b71f9de25db5 Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Thu, 17 Oct 2013 22:32:22 +0000 Subject: [PATCH] Ignore basename failures Commit 0210be22aebffc715103767922b431953f3693e1 introduced the possibility of basename being called on an empty string. Because that can happen in normal operation (such as an x86_64 kernel, in which case the PAE check will find nothing), don't allow the basename error to kill the script. Also ignore failures in the second basename call so the proper error message is echoed. Change-Id: I38a18af09ab24fda9c98cbf3ace8fd7acc6faef5 --- bin/disk-image-get-kernel | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/disk-image-get-kernel b/bin/disk-image-get-kernel index f75bc51d..933979c6 100755 --- a/bin/disk-image-get-kernel +++ b/bin/disk-image-get-kernel @@ -87,9 +87,9 @@ RAMDISK= if [ -f $WORK_DIR/etc/redhat-release ]; then # Prioritize PAE if present - KERNEL=$(basename `ls -1rv $BOOTDIR/vmlinuz* | grep PAE | grep -v debug | head -1`) + KERNEL=$(basename `ls -1rv $BOOTDIR/vmlinuz* | grep PAE | grep -v debug | head -1` || /bin/true) if [ ! $KERNEL ]; then - KERNEL=$(basename `ls -1rv $BOOTDIR/vmlinuz* | grep -v debug | head -1`) + KERNEL=$(basename `ls -1rv $BOOTDIR/vmlinuz* | grep -v debug | head -1` || /bin/true) if [ ! $KERNEL ]; then echo "No suitable kernel found." exit 1