From 0a0912234e4d3c67682109eb54c1d673770fc783 Mon Sep 17 00:00:00 2001 From: Andrei Radulescu Date: Tue, 27 Aug 2024 03:25:15 +0300 Subject: [PATCH] update bash scripts to #!/usr/bin/env bash (#1987) * update bash shebang for better compatibility including macOS * can't have anything after #bash --- board/debug/debug_h7.sh | 3 ++- board/gdb.sh | 2 +- drivers/spi/load.sh | 2 +- drivers/spi/pull-src.sh | 2 +- release/make_release.sh | 2 +- tests/ci_shell.sh | 3 ++- tests/hitl/run_parallel_tests.sh | 2 +- tests/hitl/run_serial_tests.sh | 2 +- tests/misra/install.sh | 2 +- tests/misra/test_misra.sh | 4 ++-- tests/read_st_flash.sh | 2 +- tests/setup_device_ci.sh | 4 ++-- tests/som_debug.sh | 2 +- 13 files changed, 17 insertions(+), 15 deletions(-) diff --git a/board/debug/debug_h7.sh b/board/debug/debug_h7.sh index a2bd88434..126a9c378 100755 --- a/board/debug/debug_h7.sh +++ b/board/debug/debug_h7.sh @@ -1,3 +1,4 @@ -#!/bin/bash -e +#!/usr/bin/env bash +set -e sudo openocd -f "interface/stlink.cfg" -c "transport select hla_swd" -f "target/stm32h7x.cfg" -c "init" diff --git a/board/gdb.sh b/board/gdb.sh index 3dfe994cd..aa695d6ab 100755 --- a/board/gdb.sh +++ b/board/gdb.sh @@ -1,3 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash gdb-multiarch --eval-command="target extended-remote localhost:3333" diff --git a/drivers/spi/load.sh b/drivers/spi/load.sh index b8efdbf70..910ac8728 100755 --- a/drivers/spi/load.sh +++ b/drivers/spi/load.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" diff --git a/drivers/spi/pull-src.sh b/drivers/spi/pull-src.sh index f74b94b9e..64dac9bca 100755 --- a/drivers/spi/pull-src.sh +++ b/drivers/spi/pull-src.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash set -e DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" diff --git a/release/make_release.sh b/release/make_release.sh index 5628c4998..cfecac3a1 100755 --- a/release/make_release.sh +++ b/release/make_release.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" diff --git a/tests/ci_shell.sh b/tests/ci_shell.sh index 92c0f96e8..ab87f36ca 100755 --- a/tests/ci_shell.sh +++ b/tests/ci_shell.sh @@ -1,4 +1,5 @@ -#!/bin/bash -e +#!/usr/bin/env bash +set -e DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" OP_ROOT="$DIR/../../" diff --git a/tests/hitl/run_parallel_tests.sh b/tests/hitl/run_parallel_tests.sh index b6b79d99f..f60d838c5 100755 --- a/tests/hitl/run_parallel_tests.sh +++ b/tests/hitl/run_parallel_tests.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" diff --git a/tests/hitl/run_serial_tests.sh b/tests/hitl/run_serial_tests.sh index 31270f044..4feae5e30 100755 --- a/tests/hitl/run_serial_tests.sh +++ b/tests/hitl/run_serial_tests.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" diff --git a/tests/misra/install.sh b/tests/misra/install.sh index e0a743b72..a65130ce5 100755 --- a/tests/misra/install.sh +++ b/tests/misra/install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" diff --git a/tests/misra/test_misra.sh b/tests/misra/test_misra.sh index 7fd110467..dc991a46e 100755 --- a/tests/misra/test_misra.sh +++ b/tests/misra/test_misra.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" @@ -51,7 +51,7 @@ cppcheck() { --suppress=*:*include/* --error-exitcode=2 --check-level=exhaustive \ --platform=arm32-wchar_t4 $COMMON_DEFINES --checkers-report=$CHECKLIST.tmp \ --std=c11 "$@" |& tee $OUTPUT - + cat $CHECKLIST.tmp >> $CHECKLIST rm $CHECKLIST.tmp # cppcheck bug: some MISRA errors won't result in the error exit code, diff --git a/tests/read_st_flash.sh b/tests/read_st_flash.sh index ffcfd7bbf..65b0709f6 100755 --- a/tests/read_st_flash.sh +++ b/tests/read_st_flash.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash rm -f /tmp/dump_bootstub rm -f /tmp/dump_main dfu-util -a 0 -s 0x08000000 -U /tmp/dump_bootstub diff --git a/tests/setup_device_ci.sh b/tests/setup_device_ci.sh index b45c6b466..a74ce7a2c 100755 --- a/tests/setup_device_ci.sh +++ b/tests/setup_device_ci.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash set -e @@ -19,7 +19,7 @@ fi CONTINUE_PATH="/data/continue.sh" tee $CONTINUE_PATH << EOF -#!/usr/bin/bash +#!/usr/bin/env bash sudo abctl --set_success diff --git a/tests/som_debug.sh b/tests/som_debug.sh index 9bb421971..6f0a86537 100755 --- a/tests/som_debug.sh +++ b/tests/som_debug.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash set -e DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"