From 2c9d2e1e35c1aee2f66b0f2dc3fb0a7dcae9e2c6 Mon Sep 17 00:00:00 2001 From: Bertrand Jacquin Date: Sun, 5 May 2019 17:38:38 +0100 Subject: eclass/linux-build: Simplify bootloader selection --- eclass/linux-build.eclass | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'eclass') diff --git a/eclass/linux-build.eclass b/eclass/linux-build.eclass index 66dbee5e..f8976935 100644 --- a/eclass/linux-build.eclass +++ b/eclass/linux-build.eclass @@ -177,7 +177,9 @@ _linux-build_src_prepare_build() { echo "${CONFIG_CMDLINE}" > "${WORKDIR}/boot/kernel.arg" fi - local -a BOOTLOADERS=( + local -a BOOTLOADERS=() + + BOOTLOADERS+=( sys-boot/grub:0 /boot/grub/grub.conf sys-boot/syslinux:0 /boot/extlinux/extlinux.conf ) @@ -186,14 +188,15 @@ _linux-build_src_prepare_build() { KV_INSTALLED="${KV_INSTALLED/#${CATEGORY}\/${PN}-}" if [[ -n "${KV_INSTALLED}" ]] ; then - for (( i = 0 ; i < ${#BOOTLOADERS[@]} ; i+=2 )) ; do - if ! has_version "${BOOTLOADERS[i]}" || [[ ! -e "${EPREFIX}/${BOOTLOADERS[i+1]}" ]] ; then - continue + for (( i = 0 ; i < ${#BOOTLOADERS[@]} ; i += 2 )) ; do + if has_version "${BOOTLOADERS[i]}" && [[ -e "${EPREFIX}/${BOOTLOADERS[i+1]}" ]] ; then + BOOTLOADER_DIR="${BOOTLOADERS[i+1]%/*}" + BOOTLOADER_FILE="${BOOTLOADERS[i+1]##*/}" + break fi + done - BOOTLOADER_DIR="${BOOTLOADERS[i+1]%/*}" - BOOTLOADER_FILE="${BOOTLOADERS[i+1]##*/}" - + if [[ -n "${BOOTLOADER_DIR}" && -n "${BOOTLOADER_FILE}" ]] ; then mkdir -p "${WORKDIR}/bootloader/${BOOTLOADER_DIR}" # Handle collision protect @@ -217,7 +220,7 @@ _linux-build_src_prepare_build() { fi _CONFIG_PROTECT+=( "${BOOTLOADER_DIR}/${BOOTLOADER_FILE}" ) - done + fi echo "CONFIG_PROTECT='${_CONFIG_PROTECT[@]}'" > "${WORKDIR}/env.d_42-${P}" fi -- cgit v1.2.3