From 156d3495e0dece475df10c26c7dc41a4fda2a965 Mon Sep 17 00:00:00 2001 From: Ghe Rivero Date: Mon, 9 Jun 2014 08:53:38 +0000 Subject: [PATCH] Use common element select-boot-kernel-initrd Several elements were using almost similar code to get the current kernel and initrd inside an image. After factoring out this code into a common element, modify the elements to make use of it. Change-Id: Ib547cd96b2b354b1c97342cacf5f0d0a3f70a3da --- elements/dracut-network/element-deps | 1 + .../finalise.d/98-regenerate-initramfs | 14 +++----------- 2 files changed, 4 insertions(+), 11 deletions(-) create mode 100644 elements/dracut-network/element-deps diff --git a/elements/dracut-network/element-deps b/elements/dracut-network/element-deps new file mode 100644 index 000000000..93eaa4f1a --- /dev/null +++ b/elements/dracut-network/element-deps @@ -0,0 +1 @@ +select-boot-kernel-initrd diff --git a/elements/dracut-network/finalise.d/98-regenerate-initramfs b/elements/dracut-network/finalise.d/98-regenerate-initramfs index 0b4ab2606..9d6645616 100755 --- a/elements/dracut-network/finalise.d/98-regenerate-initramfs +++ b/elements/dracut-network/finalise.d/98-regenerate-initramfs @@ -3,16 +3,8 @@ set -eu set -o pipefail -# Prioritize PAE if present -KERNEL=$(basename `ls -1rv /boot/vmlinuz* | grep PAE | grep -v debug | head -1`) -if [ ! $KERNEL ]; then - KERNEL=$(basename `ls -1rv /boot/vmlinuz* | grep -v debug | head -1`) - if [ ! $KERNEL ]; then - echo "No suitable kernel found." - exit 1 - fi -fi -KERNEL_VERSION=`echo $KERNEL | sed 's/vmlinuz-//g'` -RAMDISK=/boot/initramfs-$KERNEL_VERSION.img +RET=$(/bin/select-boot-kernel-initrd) +KERNEL_VERSION=`echo ${RET%:*} | sed 's/vmlinuz-//g'` +RAMDISK=/boot/${RET#*:} dracut --force --add "network" $RAMDISK $KERNEL_VERSION