From 056f426165c9ce8c23581fbb392ef8031d5edf01 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 11 May 2020 20:37:43 +0000 Subject: [PATCH] scripts/kernel-functions: Make this script compatible with bash versions that do not support readarray git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8900 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/kernel-functions | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/kernel-functions b/scripts/kernel-functions index 8c78ea7d3..b3a70ada3 100644 --- a/scripts/kernel-functions +++ b/scripts/kernel-functions @@ -553,14 +553,14 @@ EOF function download_and_extract_distro_rpm { [ -n "$1" ] || return $? - local arr - readarray -d ^ -t arr <<<"$1^^^^" - local kver=${arr[0]} - local distro=${arr[1]} - local release=${arr[2]} + set -- ${1//^/ } + local kver=$1 + local distro=$2 + local release=$3 ( cd "${kernel_downloads}" || exit $? - urls=($(get_srpm_urls "$distro" "$release" x86_64)) + read -a urls -r <<<"$(get_srpm_urls "$distro" "$release" x86_64 | + tr '\n' ' ')" for url in "${urls[@]}"; do wget -q -nc "${url}/kernel-${kver}.src.rpm" && break done @@ -572,7 +572,7 @@ function download_and_extract_distro_rpm { cd "${tmpdir}" && rpm2cpio "${kernel_downloads}/kernel-${kver}.src.rpm" | cpio -i --make-directories --quiet && - tar xaf linux-${kver}.tar.* && + tar xaf "linux-${kver}.tar."* && mv "linux-${kver}" ".." && cd "../linux-${kver}" ) || return $?