diff --git a/packages/bsp/common/etc/default/armbian-motd.dpkg-dist b/packages/bsp/common/etc/default/armbian-motd.dpkg-dist index 98f3fca2fb..a559a667cf 100644 --- a/packages/bsp/common/etc/default/armbian-motd.dpkg-dist +++ b/packages/bsp/common/etc/default/armbian-motd.dpkg-dist @@ -1,6 +1,14 @@ # add space-separated list of MOTD script names (without number) to exclude them from MOTD # Example: # MOTD_DISABLE="header tips updates" +# ONE_WIRE="yes" show 1-wire temperature sensor if attached MOTD_DISABLE="" -ONE_WIRE="" # yes = show 1-wire temperature sensor if attached +ONE_WIRE="" +SHOW_IP_PATTERN="^bond.*|^[ewr].*|^br.*|^lt.*|^umts.*|^lan.*" +PRIMARY_INTERFACE="$(ls -1 /sys/class/net/ | grep -v lo | sed -n -e 'H;${x;s/\n/+/g;s/^+//;p;}')" +PRIMARY_DIRECTION="rx" +STORAGE=/dev/sda1 +CPU_TEMP_LIMIT=60 +HDD_TEMP_LIMIT=60 +AMB_TEMP_LIMIT=40 diff --git a/packages/bsp/common/etc/profile.d/armbian-check-first-login-reboot.sh b/packages/bsp/common/etc/profile.d/armbian-check-first-login-reboot.sh index 1430d0f80c..fccca58870 100644 --- a/packages/bsp/common/etc/profile.d/armbian-check-first-login-reboot.sh +++ b/packages/bsp/common/etc/profile.d/armbian-check-first-login-reboot.sh @@ -8,7 +8,17 @@ # only do this for interactive shells if [ "$-" != "${-#*i}" ]; then + OutstandingPackages="$(egrep -v "linux-base|linux-image" /var/run/reboot-required.pkgs 2>/dev/null)" if [ -f "/var/run/.reboot_required" ]; then printf "\n[\e[0;91m Kernel was updated, please reboot\x1B[0m ]\n\n" + elif [ "X${OutstandingPackages}" != "X" ]; then + # No kernel update involved, just regular packages like e.g. dbus require a reboot + Packages="$(egrep -v "linux-base|linux-image" /var/run/reboot-required.pkgs | sort | uniq | tr '\n' ',' | sed -e 's/,/, /g' -e 's/,\ $//')" + OlderThanOneDay=$(find /var/run/reboot-required -mtime +1) + if [ "X${OlderThanOneDay}" = "X" ]; then + printf "\n[\e[0;92m some packages require a reboot (${Packages})\x1B[0m ]\n\n" + else + printf "\n[\e[0;91m some packages require a reboot since more than 1 day (${Packages})\x1B[0m ]\n\n" + fi fi fi 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 b8d9c9c89e..07d8c64980 100755 --- a/packages/bsp/common/etc/update-motd.d/30-armbian-sysinfo +++ b/packages/bsp/common/etc/update-motd.d/30-armbian-sysinfo @@ -11,12 +11,15 @@ # generate system information export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - THIS_SCRIPT="sysinfo" + +# don't change default values - they are lost on upgrades. Use /etc/default/armbian-motd for your values + MOTD_DISABLE="" +PRIMARY_INTERFACE="eth0" +PRIMARY_DIRECTION="rx" STORAGE=/dev/sda1 SHOW_IP_PATTERN="^bond.*|^[ewr].*|^br.*|^lt.*|^umts.*|^lan.*" - CPU_TEMP_LIMIT=60 HDD_TEMP_LIMIT=60 AMB_TEMP_LIMIT=40 @@ -225,4 +228,34 @@ display "storage/" "$storage_usage" "90" "1" "%" " of $storage_total" display "storage temp" "$storage_temp" $HDD_TEMP_LIMIT "0" "°C" "" ; a=$? display "Battery" "$battery_percent" "20" "1" "%" "$status_battery_text" echo "" +line=0 +if [[ $(command -v vnstat) ]]; then + line=$((line+1)) + traffic=$(vnstat -d 1 -i $PRIMARY_INTERFACE --oneline | cut -d";" -f4,5) + traffic_rx=$(echo $traffic | cut -d";" -f1,1 | sed -r 's/([0-9]+\.[0-9]{1})[0-9]*/\1/') + traffic_tx=$(echo $traffic | cut -d";" -f2,2 | sed -r 's/([0-9]+\.[0-9]{1})[0-9]*/\1/') + printf "${PRIMARY_DIRECTION^^} yesterday: " + if [[ $PRIMARY_DIRECTION == tx ]]; then + printf "\x1B[92m%s\x1B[0m" "$traffic_tx" + else + printf "\x1B[92m%s\x1B[0m" "$traffic_rx" + fi + printf "\t" +fi + +if [[ $(command -v zpool) ]]; then + zpoolstatus="$(zpool status &1 )" + if [[ -n $(echo $zpoolstatus | grep 'not loaded') ]]; then + : + elif [[ -n $(echo $zpoolstatus | grep 'degraded\|OFFLINE') ]]; then + printf "ZFS pool: " + echo -ne "\e[0;91mDegraded\x1B[0m" + line=$((line+1)) + else + printf "ZFS pool: " + echo -ne "\e[0;92mOnline\x1B[0m" + line=$((line+1)) + fi +fi +[[ $line -ne 0 ]] && echo "" echo "" diff --git a/packages/bsp/common/usr/lib/armbian/armbian-apt-updates b/packages/bsp/common/usr/lib/armbian/armbian-apt-updates index 09a77b726c..5cc383afa8 100755 --- a/packages/bsp/common/usr/lib/armbian/armbian-apt-updates +++ b/packages/bsp/common/usr/lib/armbian/armbian-apt-updates @@ -28,7 +28,10 @@ else fi # give up if packages are broken -[[ ! $(dpkg -l | grep ^..r) ]] && exit 0 +[[ $(dpkg -l | grep ^..r) ]] && exit 0 + +# give up if there is a dependency problem +[[ "$((apt-get upgrade -s -qq) 2>&1)" == *"Unmet dependencies"* ]] && exit 0 myfile="/var/cache/apt/archives/updates.number"