Enable board/settings mismatch detection for sun8i (trial balloon)

This commit is contained in:
Thomas Kaiser 2016-02-28 18:17:17 +01:00
parent c4a595ef33
commit 6fe91ef7b6

View File

@ -13,6 +13,15 @@ if [ "X$1" != "Xstart" ]; then
exit 1
fi
create_motd_warning() {
cat > /etc/update-motd.d/90-warning <<EOT
#!/bin/bash
echo -e "\e[0;91mAttention:\x1B[0m $1\n"
rm "\$0"
EOT
chmod +x /etc/update-motd.d/90-warning
} # create_motd_warning
TMPFILE=$(mktemp /tmp/${0##*/}.XXXXXX)
trap "rm \"${TMPFILE}\" ; exit 0" 0 1 2 3 15
dmesg >"${TMPFILE}"
@ -156,11 +165,12 @@ if [ "$ARCH" = "armv7l" ]; then
fi
# prepare board/settings mismatch detection. If we cleanup board/config names then this
# might work for all boards later and can be moved from sun8i section further down to support
# all $HARDWARE variants
# all $HARDWARE variants. Only check board after 1st login already happened to be not in
# conflict with our board auto detection mechanisms
ScriptBinName="$(echo "${ID}" | tr '[:upper:]' '[:lower:]' | sed -e 's/+/plus/' -e 's/\ //g' -e 's/2mini$/2/g' -e 's/plus2$/plus/g').bin"
ScriptBinUsed="$(readlink -f "/boot/script.bin")"
if [ "X${ScriptBinName}" != "X${ScriptBinUsed##*/}" ]; then
:
if [ "X${ScriptBinName}" != "X${ScriptBinUsed##*/}" -a ! -f "/root/.not_logged_in_yet" ]; then
create_motd_warning "It seems the image is running on ${ID} but you're using wrong settings: ${ScriptBinUsed##*/}"
fi
fi
fi