Add a test to cause the script to exit cleanly on non-Pi hardware

At present, the update script exits cleanly in the case it finds itself
run on Pi hardware prior to the 4/CM4/400, but if installed on non-Pi
hardware exits with various slightly cryptic errors (missing vcgencmd
and some subsequent math errors from trying to bit-shift the empty
BOARD_INFO variable).

This patch adds a similar exit to the non-Pi 4 case, with a slightly
more useful message.
This commit is contained in:
Dave Jones
2021-06-10 10:04:13 +01:00
parent 34aa94bdd2
commit 71ef83abbc

View File

@@ -315,8 +315,11 @@ checkDependencies() {
BOARD_INFO="$(od -v -An -t x1 /sys/firmware/devicetree/base/system/linux,revision | tr -d ' \n')" BOARD_INFO="$(od -v -An -t x1 /sys/firmware/devicetree/base/system/linux,revision | tr -d ' \n')"
elif grep -q Revision /proc/cpuinfo; then elif grep -q Revision /proc/cpuinfo; then
BOARD_INFO="$(sed -n '/^Revision/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo)" BOARD_INFO="$(sed -n '/^Revision/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo)"
else elif command -v vcgencmd > /dev/null; then
BOARD_INFO="$(vcgencmd otp_dump | grep '30:' | sed 's/.*://')" BOARD_INFO="$(vcgencmd otp_dump | grep '30:' | sed 's/.*://')"
else
echo "No Raspberry Pi board info found"
exit ${EXIT_SUCCESS}
fi fi
if [ $(((0x$BOARD_INFO >> 23) & 1)) -eq 0 ] || [ $(((0x$BOARD_INFO >> 12) & 15)) -ne 3 ]; then if [ $(((0x$BOARD_INFO >> 23) & 1)) -eq 0 ] || [ $(((0x$BOARD_INFO >> 12) & 15)) -ne 3 ]; then