2022-10-30 14:33:51 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
# Description: check various bad patterns with grep
|
2022-11-20 15:36:28 +00:00
|
|
|
# https://postmarketos.org/pmb-ci
|
2022-10-30 14:33:51 +00:00
|
|
|
|
|
|
|
if [ "$(id -u)" = 0 ]; then
|
|
|
|
set -x
|
|
|
|
apk -q add grep
|
|
|
|
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Find CHANGEMEs in APKBUILDs
|
2023-03-16 21:14:21 +00:00
|
|
|
if grep -qr '(CHANGEME!)' -- *; then
|
2022-10-30 14:33:51 +00:00
|
|
|
echo "ERROR: Please replace '(CHANGEME!)' in the following files:"
|
2023-03-16 21:14:21 +00:00
|
|
|
grep --color=always -r '(CHANGEME!)' -- *
|
2022-10-30 14:33:51 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2022-10-30 15:48:16 +00:00
|
|
|
|
|
|
|
# DTBs installed to /usr/share/db
|
2023-03-16 21:14:21 +00:00
|
|
|
# shellcheck disable=SC2016
|
2023-01-11 23:29:00 +00:00
|
|
|
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:'
|
2023-03-16 21:14:21 +00:00
|
|
|
# shellcheck disable=SC2016
|
2023-01-11 23:29:00 +00:00
|
|
|
grep --color=always -r 'INSTALL_DTBS_PATH="$pkgdir"/usr/share/dtb' device/
|
2023-01-11 23:00:00 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2023-03-06 07:27:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Find old mkinitfs paths (pre mkinitfs 2.0)
|
2023-03-16 21:14:21 +00:00
|
|
|
if grep -qr '/etc/postmarketos-mkinitfs' -- *; then
|
2023-03-06 07:27:08 +00:00
|
|
|
echo "ERROR: Please replace '/etc/postmarketos-mkinitfs' with '/usr/share/mkinitfs' in the following files:"
|
2023-03-16 21:14:21 +00:00
|
|
|
grep --color=always -r '/etc/postmarketos-mkinitfs' -- *
|
2023-03-06 07:27:08 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2023-03-16 21:14:21 +00:00
|
|
|
if grep -qr '/usr/share/postmarketos-mkinitfs' -- *; then
|
2023-03-06 07:27:08 +00:00
|
|
|
echo "ERROR: Please replace '/usr/share/postmarketos-mkinitfs' with '/usr/share/mkinitfs' in the following files:"
|
2023-03-16 21:14:21 +00:00
|
|
|
grep --color=always -r '/usr/share/postmarketos-mkinitfs' -- *
|
2023-03-06 07:27:08 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2023-05-29 12:59:50 +00:00
|
|
|
|
|
|
|
# Direct sourcing of deviceinfo
|
|
|
|
if grep --exclude='source_deviceinfo' -qEr 'source /etc/deviceinfo|\. /etc/deviceinfo' -- *; then
|
|
|
|
echo 'ERROR: Please source the source_deviceinfo script instead of sourcing deviceinfo directly!'
|
|
|
|
grep --color=always --exclude='rootfs-usr-share-misc-source_deviceinfo' -Er 'source /etc/deviceinfo|\. /etc/deviceinfo' -- *
|
|
|
|
exit 1
|
|
|
|
fi
|