From e26f9148fdda9cae7593a592bbaa6764ca7399e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Tue, 21 Apr 2026 18:03:29 +0200 Subject: [PATCH] tools: Fix shellcheck issues in apply_patches.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix shellcheck warnings and notes identified by running shellcheck --severity=style. Signed-off-by: Fabiano FidĂȘncio --- tools/packaging/scripts/apply_patches.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/packaging/scripts/apply_patches.sh b/tools/packaging/scripts/apply_patches.sh index 552d2e3c88..6644405db8 100755 --- a/tools/packaging/scripts/apply_patches.sh +++ b/tools/packaging/scripts/apply_patches.sh @@ -8,10 +8,11 @@ # set -e -script_dir="$(realpath $(dirname $0))" +# shellcheck disable=SC2034 +script_dir="$(realpath "$(dirname "$0")")" patches_dir="$1" -if [ -z "$patches_dir" ]; then +if [[ -z "${patches_dir}" ]]; then cat <<-EOF Apply patches to the sources at the current directory. @@ -34,13 +35,13 @@ if [ -z "$patches_dir" ]; then exit 1 fi -echo "INFO: Apply patches from $patches_dir" -if [ -d "$patches_dir" ]; then - patches=($(find "$patches_dir" -maxdepth 1 -name '*.patch'|sort -t- -k1,1n)) +echo "INFO: Apply patches from ${patches_dir}" +if [[ -d "${patches_dir}" ]]; then + mapfile -t patches < <(find "${patches_dir}" -maxdepth 1 -name '*.patch'|sort -t- -k1,1n) echo "INFO: Found ${#patches[@]} patches" for patch in "${patches[@]}"; do - echo "INFO: Apply $patch" - patch -p1 < "$patch" || \ + echo "INFO: Apply ${patch}" + patch -p1 < "${patch}" || \ { echo >&2 "ERROR: Not applied. Exiting..."; exit 1; } done else