diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh index 8df5570373b6..d58ae8ff6519 100644 --- a/lib/functions/configuration/main-config.sh +++ b/lib/functions/configuration/main-config.sh @@ -94,7 +94,7 @@ function do_main_configuration() { USEALLCORES=yes # Use all CPU cores for compiling [[ -z $EXIT_PATCHING_ERROR ]] && EXIT_PATCHING_ERROR="" # exit patching if failed - [[ -z $HOST ]] && HOST="$BOARD" # set hostname to the board + [[ -z $HOST ]] && HOST="$BOARD" cd "${SRC}" || exit [[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7 diff --git a/packages/bsp/common/etc/default/armbian-motd.dpkg-dist b/packages/bsp/common/etc/default/armbian-motd.dpkg-dist index da1dbb0b1e69..612c6982e8fa 100644 --- a/packages/bsp/common/etc/default/armbian-motd.dpkg-dist +++ b/packages/bsp/common/etc/default/armbian-motd.dpkg-dist @@ -6,7 +6,7 @@ MOTD_DISABLE="" ONE_WIRE="" -HIDE_IP_PATTERN="^dummy0|^lo|^docker" +HIDE_IP_PATTERN="^dummy0|^lo|^docker|^hassio" PRIMARY_INTERFACE="$(ip route | grep '^default' | sed "s/.*dev //" | cut -d" " -f1)" PRIMARY_DIRECTION="rx" STORAGE=/dev/sda1 diff --git a/packages/bsp/common/etc/update-motd.d/00-clear b/packages/bsp/common/etc/update-motd.d/00-clear new file mode 100755 index 000000000000..e20783b23ea7 --- /dev/null +++ b/packages/bsp/common/etc/update-motd.d/00-clear @@ -0,0 +1,27 @@ +#!/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="clear" +MOTD_DISABLE="" + +[[ -f /etc/default/armbian-motd ]] && . /etc/default/armbian-motd + +for f in $MOTD_DISABLE; do + [[ $f == $THIS_SCRIPT ]] && exit 0 +done + +# Clear screen +if [ -f /bin/bash ]; then +export TERM="$(/bin/bash -c 'echo $TERM')" +fi +clear + +exit 0 diff --git a/packages/bsp/common/etc/update-motd.d/10-armbian-header b/packages/bsp/common/etc/update-motd.d/10-armbian-header index 92a3f8db7984..bac5b464efd8 100755 --- a/packages/bsp/common/etc/update-motd.d/10-armbian-header +++ b/packages/bsp/common/etc/update-motd.d/10-armbian-header @@ -50,6 +50,7 @@ KERNELID=$(uname -r) echo -e "\e[1;91m$(figlet -f small " $VENDOR")\e[0m"; # Display version, board, and kernel version +[[ $VERSION == *trunk* ]] && VERSION=$(echo -e $VERSION | cut -d"." -f1-2 | sed "s/\$/ rolling/") echo -e " \e[0;92mv${VERSION}\x1B[0m for $BOARD_NAME running Armbian Linux \e[0;92m${KERNELID^}\x1B[0m" # render image and board type diff --git a/packages/bsp/common/etc/update-motd.d/30-armbian-sysinfo b/packages/bsp/common/etc/update-motd.d/30-armbian-sysinfo index 4ce2ae7c46e1..2b52bcf7b58a 100755 --- a/packages/bsp/common/etc/update-motd.d/30-armbian-sysinfo +++ b/packages/bsp/common/etc/update-motd.d/30-armbian-sysinfo @@ -215,4 +215,4 @@ if [[ $(command -v zpool) ]]; then line=$((line+1)) fi fi -if [[ $line -ne 0 ]]; then echo ""; fi +echo "" diff --git a/packages/bsp/common/etc/update-motd.d/41-commands b/packages/bsp/common/etc/update-motd.d/41-commands index 457093edd305..1db74ae366e8 100755 --- a/packages/bsp/common/etc/update-motd.d/41-commands +++ b/packages/bsp/common/etc/update-motd.d/41-commands @@ -18,29 +18,43 @@ for f in $MOTD_DISABLE; do [[ $f == $THIS_SCRIPT ]] && exit 0 done -printf "\e[0;90m Commands: \x1B[0m\n" #; printf '%.s─' $(seq 1 39); echo -e "\x1B[0m" -echo "" - list=( - "System config ","sudo ","armbian-config" - "System monitor ","","htop" + "System config","sudo ","armbian-config" + "System monitor","","htop" ) -# just for easier coloring -yellow() { printf '%s' $'\e[1;33m' "$*" $'\e[0m'; } - +# verify if command exits on the system +cmd_count=0 +name_len=0 +output=() for l in "${list[@]}" do name=$(echo $l | cut -d"," -f1) sudo=$(echo $l | cut -d"," -f2) command=$(echo $l | cut -d"," -f3) - if command -v $command &> /dev/null then - printf "$(yellow " %-26s %-0s"): $sudo$command\n" "$name" + # seek for maximum description lenght + if [ ${#name} -ge $name_len ]; then + name_len=${#name} + fi + cmd_count=$(( cmd_count +1 )) + output+=("${name},${sudo},${command}") fi done -echo -e "\033[0m" +# show list for existing command only +if [[ "${cmd_count}" -gt 0 ]]; then + printf "\e[0;90m Commands: \x1B[0m\n" #; printf '%.s─' $(seq 1 39); echo -e "\x1B[0m" + echo "" + for l in "${output[@]}" + do + name=$(echo $l | cut -d"," -f1) + sudo=$(echo $l | cut -d"," -f2) + command=$(echo $l | cut -d"," -f3) + printf " \e[1;33m%-${name_len}s\e[0m %-0s: $sudo$command\n" "$name" + done + echo -e "\033[0m" +fi exit 0 diff --git a/packages/bsp/common/usr/lib/armbian/armbian-firstlogin b/packages/bsp/common/usr/lib/armbian/armbian-firstlogin index 0e849f3377d1..4409e9ce28bf 100755 --- a/packages/bsp/common/usr/lib/armbian/armbian-firstlogin +++ b/packages/bsp/common/usr/lib/armbian/armbian-firstlogin @@ -895,7 +895,10 @@ if [[ -f /root/.not_logged_in_yet && -n $(tty) ]]; then who -la | grep root | grep -q tty1 && exit 1 else - # no display manager detected + # no display manager detected -> clear screen and show motd + clear + run-parts --lsbsysinit /etc/update-motd.d + # Display reboot recommendation if necessary if [[ -f /var/run/resize2fs-reboot ]]; then printf "\n\n\e[0;91mWarning: a reboot is needed to finish resizing the filesystem \x1B[0m \n"