summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Jacquin <bertrand@jacquin.bzh>2019-05-05 17:38:38 +0100
committerBertrand Jacquin <bertrand@jacquin.bzh>2019-05-05 17:38:38 +0100
commit2c9d2e1e35c1aee2f66b0f2dc3fb0a7dcae9e2c6 (patch)
tree8d439975c7f688dee466b928d7549767f8bb43b7
parenteclass/linux-build: avoid globbing with doins (diff)
downloadportage-2c9d2e1e35c1aee2f66b0f2dc3fb0a7dcae9e2c6.tar.xz
eclass/linux-build: Simplify bootloader selection
-rw-r--r--eclass/linux-build.eclass19
1 files changed, 11 insertions, 8 deletions
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