build/packages/bsp/common/etc/update-motd.d/10-armbian-header

57 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
#
# Copyright (c) Authors: https://www.armbian.com/authors
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
# DO NOT EDIT THIS FILE but add config options to /etc/default/armbian-motd
# any changes will be lost on board support package update
THIS_SCRIPT="header"
MOTD_DISABLE=""
[[ -f /etc/armbian-release ]] && . /etc/armbian-release
if [[ -f /etc/armbian-distribution-status ]]; then
. /etc/armbian-distribution-status
[[ -f /etc/lsb-release ]] && DISTRIBUTION_CODENAME=$(grep CODENAME /etc/lsb-release | cut -d"=" -f2)
[[ -z "$DISTRIBUTION_CODENAME" && -f /etc/os-release ]] && DISTRIBUTION_CODENAME=$(grep VERSION_CODENAME /etc/os-release | cut -d"=" -f2)
[[ -z "$DISTRIBUTION_CODENAME" && -x /usr/bin/lsb_release ]] && DISTRIBUTION_CODENAME=$(/usr/bin/lsb_release -c | cut -d":" -f2 | tr -d "\t")
DISTRIBUTION_STATUS=$(grep "$DISTRIBUTION_CODENAME" /etc/armbian-distribution-status | cut -d"=" -f2)
fi
[[ -f /etc/default/armbian-motd ]] && . /etc/default/armbian-motd
for f in $MOTD_DISABLE; do
[[ $f == $THIS_SCRIPT ]] && exit 0
done
KERNELID=$(uname -r)
# Odroid N2 exception
[[ -f /proc/device-tree/model ]] && [[ -n $(tr -d '\000' < /proc/device-tree/model | grep ODROID | grep Plus) ]] && BOARD_NAME+="+"
TERM=linux toilet -f standard -F metal $(echo $BOARD_NAME | sed 's/Orange Pi/OPi/' | sed 's/NanoPi/NPi/' | sed 's/Banana Pi/BPi/')
echo -e "Welcome to \e[0;91mArmbian ${VERSION} ${DISTRIBUTION_CODENAME^}\x1B[0m with $([[ $BRANCH == edge ]] && echo -e "\e[0;91mbleeding\x1B[0m edge " )\e[0;91mLinux $KERNELID\x1B[0m\n"
# displaying status warnings
if [[ "$IMAGE_TYPE" != "stable" ]]; then
[[ "$IMAGE_TYPE" == "user-built" ]] && UNSUPPORTED_TEXT="built from trunk"
[[ "$IMAGE_TYPE" == "nightly" ]] && UNSUPPORTED_TEXT="untested automated build"
else
[[ "$BOARD_TYPE" == "csc" || "$BOARD_TYPE" == "tvb" ]] && UNSUPPORTED_TEXT="community creations"
[[ "$BOARD_TYPE" == "wip" ]] && UNSUPPORTED_TEXT="work in progress"
[[ "$BOARD_TYPE" == "eos" ]] && UNSUPPORTED_TEXT="end of life"
fi
if [[ -n $DISTRIBUTION_STATUS && $DISTRIBUTION_STATUS != supported ]]; then
[[ -n $UNSUPPORTED_TEXT ]] && UNSUPPORTED_TEXT+=" & "
UNSUPPORTED_TEXT+="unsupported ($DISTRIBUTION_CODENAME) userspace!"
fi
if [[ -n $UNSUPPORTED_TEXT ]]; then
echo -e "\e[0;91mNo end-user support: \x1B[0m$UNSUPPORTED_TEXT\n"
fi