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
|
|
|
|
2024-01-18 21:49:27 +00:00
|
|
|
exit_code=0
|
|
|
|
|
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!)' -- *
|
2024-01-18 21:49:27 +00:00
|
|
|
exit_code=1
|
2022-10-30 14:33:51 +00:00
|
|
|
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/
|
2024-01-18 21:49:27 +00:00
|
|
|
exit_code=1
|
2023-01-11 23:00:00 +00:00
|
|
|
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' -- *
|
2024-01-18 21:49:27 +00:00
|
|
|
exit_code=1
|
2023-03-06 07:27:08 +00:00
|
|
|
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' -- *
|
2024-01-18 21:49:27 +00:00
|
|
|
exit_code=1
|
2023-03-06 07:27:08 +00:00
|
|
|
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' -- *
|
2024-01-18 21:49:27 +00:00
|
|
|
exit_code=1
|
2023-05-29 12:59:50 +00:00
|
|
|
fi
|
2023-06-27 16:05:05 +00:00
|
|
|
|
|
|
|
# Removed deviceinfo variable
|
|
|
|
if grep -qr 'deviceinfo_modules_initfs' -- *; then
|
|
|
|
echo 'ERROR: deviceinfo_modules_initfs variable has been removed. Use "modules-initfs" file instead.'
|
|
|
|
grep --color=always -r 'deviceinfo_modules_initfs' -- *
|
2024-01-18 21:49:27 +00:00
|
|
|
exit_code=1
|
2023-06-27 16:05:05 +00:00
|
|
|
fi
|
2024-01-18 12:43:06 +00:00
|
|
|
|
|
|
|
POSTMARKETOS_WALLPAPER_PATH='/usr/share/wallpapers/postmarketos.jpg'
|
|
|
|
# The excluded devices are "grandfathered in". New devices should not be added here.
|
|
|
|
# See https://gitlab.com/postmarketOS/pmaports/-/issues/2529
|
|
|
|
if grep -qr $POSTMARKETOS_WALLPAPER_PATH \
|
|
|
|
--exclude-dir='device-pine64-pinetab' \
|
|
|
|
--exclude-dir='device-oneplus-kebab' \
|
|
|
|
--exclude-dir='device-xiaomi-willow' \
|
|
|
|
-- device; then
|
|
|
|
echo "ERROR: Please don't include configuration files that set the default wallpaper in device-specific packages!"
|
|
|
|
grep --color=always -r $POSTMARKETOS_WALLPAPER_PATH \
|
|
|
|
--exclude-dir='device-pine64-pinetab' \
|
|
|
|
--exclude-dir='device-oneplus-kebab' \
|
|
|
|
--exclude-dir='device-xiaomi-willow' \
|
|
|
|
-- device
|
2024-01-18 21:49:27 +00:00
|
|
|
exit_code=1
|
2024-01-18 12:43:06 +00:00
|
|
|
fi
|
2024-01-18 21:49:27 +00:00
|
|
|
|
2024-01-28 18:26:51 +00:00
|
|
|
OPENRC_SERVICE_FILES=$(find . -name '*.initd')
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
if grep -q 'before wpa_supplicant' $OPENRC_SERVICE_FILES; then
|
|
|
|
echo "ERROR: Please use 'before wlan' in OpenRC service files! This ensures compatibility with both wpa_supplicant and iwd."
|
|
|
|
grep --color=always 'before wpa_supplicant' $OPENRC_SERVICE_FILES
|
|
|
|
exit_code=1
|
|
|
|
fi
|
|
|
|
|
2024-06-18 19:53:59 +00:00
|
|
|
if grep -qEr 'PMOS_NO_OUTPUT_REDIRECT' -- *; then
|
|
|
|
echo "ERROR: PMOS_NO_OUTPUT_REDIRECT is deprecated and doesn't do anything."
|
|
|
|
echo "Please remove it from the following files:"
|
|
|
|
grep --color=always -Er 'PMOS_NO_OUTPUT_REDIRECT' -- *
|
|
|
|
exit_code=1
|
|
|
|
fi
|
|
|
|
|
2024-01-18 21:49:27 +00:00
|
|
|
exit "$exit_code"
|