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
This commit is contained in:
Juerg Haefliger 2014-06-27 11:11:16 +02:00
parent 93be491c46
commit 3af14a5bad

View File

@ -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))