CI: adjust scripts to pass shellcheck (MR 3960)

This commit is contained in:
Oliver Smith 2023-03-16 22:14:21 +01:00
parent 654d1a4ed7
commit eb37732514
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
5 changed files with 13 additions and 10 deletions

View file

@ -12,7 +12,7 @@ if [ "$(id -u)" = 0 ]; then
fi fi
# Wrap pmbootstrap to use this repository for --aports # 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="$(command -v pmbootstrap)"
pmbootstrap() { pmbootstrap() {
"$_pmbootstrap" --aports="$pmaports" "$@" "$_pmbootstrap" --aports="$pmaports" "$@"

View file

@ -9,30 +9,32 @@ if [ "$(id -u)" = 0 ]; then
fi fi
# Find CHANGEMEs in APKBUILDs # Find CHANGEMEs in APKBUILDs
if grep -qr '(CHANGEME!)' *; then if grep -qr '(CHANGEME!)' -- *; then
echo "ERROR: Please replace '(CHANGEME!)' in the following files:" echo "ERROR: Please replace '(CHANGEME!)' in the following files:"
grep --color=always -r '(CHANGEME!)' * grep --color=always -r '(CHANGEME!)' -- *
exit 1 exit 1
fi fi
# DTBs installed to /usr/share/db # DTBs installed to /usr/share/db
# shellcheck disable=SC2016
if grep -qr 'INSTALL_DTBS_PATH="$pkgdir"/usr/share/dtb' device/; then 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: 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: Unless you have a good reason not to, please put them in /boot/dtbs'
echo 'ERROR: Files that need fixing:' echo 'ERROR: Files that need fixing:'
# shellcheck disable=SC2016
grep --color=always -r 'INSTALL_DTBS_PATH="$pkgdir"/usr/share/dtb' device/ grep --color=always -r 'INSTALL_DTBS_PATH="$pkgdir"/usr/share/dtb' device/
exit 1 exit 1
fi fi
# Find old mkinitfs paths (pre mkinitfs 2.0) # 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:" 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 exit 1
fi 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:" 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 exit 1
fi fi

View file

@ -12,7 +12,7 @@ if [ "$(id -u)" = 0 ]; then
fi fi
# Wrap pmbootstrap to use this repository for --aports # 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="$(command -v pmbootstrap)"
pmbootstrap() { pmbootstrap() {
"$_pmbootstrap" --aports="$pmaports" "$@" "$_pmbootstrap" --aports="$pmaports" "$@"

View file

@ -3,7 +3,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "usage: $(basename $0) \$CI_PROJECT_DIR" echo "usage: $(basename "$0") \$CI_PROJECT_DIR"
exit 1 exit 1
fi fi

View file

@ -20,7 +20,7 @@ if [ -z "$(command -v pytest)" ]; then
fi fi
# Wrap pmbootstrap to use this repository for --aports # 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="$(command -v pmbootstrap)"
pmbootstrap() { pmbootstrap() {
"$_pmbootstrap" --aports="$pmaports" "$@" "$_pmbootstrap" --aports="$pmaports" "$@"
@ -34,6 +34,7 @@ pmbootstrap -q shutdown
# Make sure we have a valid device (pmbootstrap#1128) # Make sure we have a valid device (pmbootstrap#1128)
device="$(pmbootstrap config device)" device="$(pmbootstrap config device)"
deviceinfo="$pmaports/device/*/device-$device/deviceinfo" deviceinfo="$pmaports/device/*/device-$device/deviceinfo"
# shellcheck disable=SC2086
if ! [ -e $deviceinfo ]; then if ! [ -e $deviceinfo ]; then
echo "ERROR: Could not find deviceinfo file for selected device '$device'." echo "ERROR: Could not find deviceinfo file for selected device '$device'."
echo "Expected path: $deviceinfo" echo "Expected path: $deviceinfo"