From 3af14a5badf6ea7e02ddf482c675383be13b5e5d Mon Sep 17 00:00:00 2001 From: Juerg Haefliger Date: Fri, 27 Jun 2014 11:11:16 +0200 Subject: [PATCH] Handle non-existing *generic kernel and initrd Finding the Debian boot kernel and initrd is collapsed into a single statement so that the script doesn't bail out when 'set -o pipefail' is set and the *generic kernel and initrd are absent. Change-Id: Ifd616818f7387e6f102636c7cf186be6097f1d5c Closes-Bug: 1335016 --- lib/img-functions | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/img-functions b/lib/img-functions index c65742f3..d973f29e 100644 --- a/lib/img-functions +++ b/lib/img-functions @@ -158,11 +158,8 @@ function select_boot_kernel_initrd () { exit 1 fi elif [ -f $TARGET_ROOT/etc/debian_version ]; then - KERNEL=$(basename $(ls -1rv $BOOTDIR/vmlinuz*generic | head -1)) - RAMDISK=$(basename $(ls -1rv $BOOTDIR/initrd*generic | head -1)) - # in case files with "generic" suffix were not found, fall back to default - KERNEL=${KERNEL:-$(basename $(ls -1rv $BOOTDIR/vmlinuz* | head -1))} - RAMDISK=${RAMDISK:-$(basename $(ls -1rv $BOOTDIR/initrd* | head -1))} + KERNEL=$(basename $(ls -1rv $BOOTDIR/vmlinuz*generic 2>/dev/null || ls -1rv $BOOTDIR/vmlinuz* | head -1)) + RAMDISK=$(basename $(ls -1rv $BOOTDIR/initrd*generic 2>/dev/null || ls -1rv $BOOTDIR/initrd* | head -1)) elif [ -f $TARGET_ROOT/etc/SuSE-release ]; then KERNEL=$(basename $(readlink -e $BOOTDIR/vmlinuz)) RAMDISK=$(basename $(readlink -e $BOOTDIR/initrd))