From 9429a9930f668565047996085098ee792bdd91ed Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 11 May 2020 20:36:04 +0000 Subject: [PATCH 1/3] scripts/rhel-rpm-functions: Use ${...//...} instead of setting the IFS variable git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8899 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/rhel-rpm-functions | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/scripts/rhel-rpm-functions b/scripts/rhel-rpm-functions index ffccee089..69e86aada 100644 --- a/scripts/rhel-rpm-functions +++ b/scripts/rhel-rpm-functions @@ -11,9 +11,7 @@ function get_srpm_urls() { distro="$1" releasever="$2" arch="$3" - IFS=. - set -- "$2" - unset IFS + set -- ${2//./ } releasevermajor="$1" releaseverminor="$2" @@ -67,9 +65,7 @@ function get_rpm_urls() { distro="$1" releasever="$2" arch="$3" - IFS=. - set -- "$2" - unset IFS + set -- ${2//./ } releasevermajor="$1" releaseverminor="$2" From 056f426165c9ce8c23581fbb392ef8031d5edf01 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 11 May 2020 20:37:43 +0000 Subject: [PATCH 2/3] 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 $? From 58a1ea5bd7d9028115a10a4f068a42f2dd8aa44a Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 11 May 2020 20:38:25 +0000 Subject: [PATCH 3/3] scripts/generate-kernel-patch: Use read instead of readarray and fix shellcheck warnings git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8901 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/generate-kernel-patch | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/scripts/generate-kernel-patch b/scripts/generate-kernel-patch index fbf736e19..4452843d7 100755 --- a/scripts/generate-kernel-patch +++ b/scripts/generate-kernel-patch @@ -105,19 +105,19 @@ EOF # Run the script specialize_patch with appropriate options on the patch # passed via stdin and send the specialized patch to stdout. function specialize_patch { - local arr ao - readarray -d ^ -t arr <<<"$1^^^^" - local kver=${arr[0]} - local distro=${arr[1]} - local release=${arr[2]} - readarray -d . -t arr <<<"$release..." - local releasevermajor="${arr[0]}" - local releaseverminor="${arr[1]}" + local ao + set -- ${1//^/ } + local kver=$1 + local distro=$2 + local release=$3 + set -- ${release//./ } + local releasevermajor="$1" + local releaseverminor="$2" if [ -n "$releasevermajor" ]; then ao=( - -v RHEL_MAJOR=$releasevermajor - -v RHEL_MINOR=$releaseverminor - -v RHEL_RELEASE_CODE=$((releasevermajor * 256 + releaseverminor)) + -v "RHEL_MAJOR=$releasevermajor" + -v "RHEL_MINOR=$releaseverminor" + -v "RHEL_RELEASE_CODE=$((releasevermajor * 256 + releaseverminor))" ) fi if [ "${enable_specialize}" = "true" ]; then @@ -225,12 +225,6 @@ fi # Strip patch level from the kernel version number. full_kver="$1" kver="$(kernel_version "$1")" -# kver3: first three components of the version number. -if [ "${1#2.}" != "$1" ]; then - kver3="$kver" -else - kver3="$1" -fi # Include fcst in the patch for kernel versions 2.6.33 and later. if kernel_version_le "2.6.37" "${kver}"; then @@ -296,7 +290,6 @@ done # General kernel patches. -scsi_exec_req_fifo_defined=0 scst_io_context=0 scst_03_public_headers="scst/include/scst.h scst/include/scst_const.h \