From 6fe91ef7b61c74e378ed5c0d0058534186d2a0f7 Mon Sep 17 00:00:00 2001 From: Thomas Kaiser Date: Sun, 28 Feb 2016 18:17:17 +0100 Subject: [PATCH] Enable board/settings mismatch detection for sun8i (trial balloon) --- scripts/armhwinfo | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/armhwinfo b/scripts/armhwinfo index 935305c42d..bd05db902b 100644 --- a/scripts/armhwinfo +++ b/scripts/armhwinfo @@ -13,6 +13,15 @@ if [ "X$1" != "Xstart" ]; then exit 1 fi +create_motd_warning() { +cat > /etc/update-motd.d/90-warning <"${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