From eb37732514886707b456909fa62f5ff06dbecfcc Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Thu, 16 Mar 2023 22:14:21 +0100 Subject: [PATCH] CI: adjust scripts to pass shellcheck (MR 3960) --- .ci/apkbuild-lint.sh | 2 +- .ci/grep.sh | 14 ++++++++------ .ci/kconfig.sh | 2 +- .ci/lib/move_logs.sh | 2 +- .ci/pytest.sh | 3 ++- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.ci/apkbuild-lint.sh b/.ci/apkbuild-lint.sh index 08f9cf183..e7505f77f 100755 --- a/.ci/apkbuild-lint.sh +++ b/.ci/apkbuild-lint.sh @@ -12,7 +12,7 @@ if [ "$(id -u)" = 0 ]; then fi # Wrap pmbootstrap to use this repository for --aports -pmaports="$(cd $(dirname $0)/..; pwd -P)" +pmaports="$(cd "$(dirname "$0")"/..; pwd -P)" _pmbootstrap="$(command -v pmbootstrap)" pmbootstrap() { "$_pmbootstrap" --aports="$pmaports" "$@" diff --git a/.ci/grep.sh b/.ci/grep.sh index 583ff29b9..760d6f9cc 100755 --- a/.ci/grep.sh +++ b/.ci/grep.sh @@ -9,30 +9,32 @@ if [ "$(id -u)" = 0 ]; then fi # Find CHANGEMEs in APKBUILDs -if grep -qr '(CHANGEME!)' *; then +if grep -qr '(CHANGEME!)' -- *; then echo "ERROR: Please replace '(CHANGEME!)' in the following files:" - grep --color=always -r '(CHANGEME!)' * + grep --color=always -r '(CHANGEME!)' -- * exit 1 fi # DTBs installed to /usr/share/db +# shellcheck disable=SC2016 if grep -qr 'INSTALL_DTBS_PATH="$pkgdir"/usr/share/dtb' device/; then echo 'ERROR: Please do not install dtbs to /usr/share/dtb!' echo 'ERROR: Unless you have a good reason not to, please put them in /boot/dtbs' echo 'ERROR: Files that need fixing:' + # shellcheck disable=SC2016 grep --color=always -r 'INSTALL_DTBS_PATH="$pkgdir"/usr/share/dtb' device/ exit 1 fi # Find old mkinitfs paths (pre mkinitfs 2.0) -if grep -qr '/etc/postmarketos-mkinitfs' *; then +if grep -qr '/etc/postmarketos-mkinitfs' -- *; then echo "ERROR: Please replace '/etc/postmarketos-mkinitfs' with '/usr/share/mkinitfs' in the following files:" - grep --color=always -r '/etc/postmarketos-mkinitfs' * + grep --color=always -r '/etc/postmarketos-mkinitfs' -- * exit 1 fi -if grep -qr '/usr/share/postmarketos-mkinitfs' *; then +if grep -qr '/usr/share/postmarketos-mkinitfs' -- *; then echo "ERROR: Please replace '/usr/share/postmarketos-mkinitfs' with '/usr/share/mkinitfs' in the following files:" - grep --color=always -r '/usr/share/postmarketos-mkinitfs' * + grep --color=always -r '/usr/share/postmarketos-mkinitfs' -- * exit 1 fi diff --git a/.ci/kconfig.sh b/.ci/kconfig.sh index fa5d50d23..f51ff6c60 100755 --- a/.ci/kconfig.sh +++ b/.ci/kconfig.sh @@ -12,7 +12,7 @@ if [ "$(id -u)" = 0 ]; then fi # Wrap pmbootstrap to use this repository for --aports -pmaports="$(cd $(dirname $0)/..; pwd -P)" +pmaports="$(cd "$(dirname "$0")"/..; pwd -P)" _pmbootstrap="$(command -v pmbootstrap)" pmbootstrap() { "$_pmbootstrap" --aports="$pmaports" "$@" diff --git a/.ci/lib/move_logs.sh b/.ci/lib/move_logs.sh index 3a524f2b4..52d3e27eb 100755 --- a/.ci/lib/move_logs.sh +++ b/.ci/lib/move_logs.sh @@ -3,7 +3,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later if [ -z "$1" ]; then - echo "usage: $(basename $0) \$CI_PROJECT_DIR" + echo "usage: $(basename "$0") \$CI_PROJECT_DIR" exit 1 fi diff --git a/.ci/pytest.sh b/.ci/pytest.sh index b90ce0b19..6e0bb741d 100755 --- a/.ci/pytest.sh +++ b/.ci/pytest.sh @@ -20,7 +20,7 @@ if [ -z "$(command -v pytest)" ]; then fi # Wrap pmbootstrap to use this repository for --aports -pmaports="$(cd $(dirname $0)/..; pwd -P)" +pmaports="$(cd "$(dirname "$0")"/..; pwd -P)" _pmbootstrap="$(command -v pmbootstrap)" pmbootstrap() { "$_pmbootstrap" --aports="$pmaports" "$@" @@ -34,6 +34,7 @@ pmbootstrap -q shutdown # Make sure we have a valid device (pmbootstrap#1128) device="$(pmbootstrap config device)" deviceinfo="$pmaports/device/*/device-$device/deviceinfo" +# shellcheck disable=SC2086 if ! [ -e $deviceinfo ]; then echo "ERROR: Could not find deviceinfo file for selected device '$device'." echo "Expected path: $deviceinfo"