From 3adbd8378c90db5c89902b940932065b87930741 Mon Sep 17 00:00:00 2001 From: SuperKali Date: Mon, 30 Sep 2024 21:30:05 +0000 Subject: [PATCH 1/3] Improvement: Update MOTD to include IPv6 addresses (local) and exclude specified interfaces by default - Added functionality to display local IPv6 addresses in the MOTD. - Default behavior now excludes interfaces matching 'br-*' and 'veth'. --- .../common/etc/default/armbian-motd.dpkg-dist | 2 +- .../etc/update-motd.d/10-armbian-header | 130 +++++++++--------- 2 files changed, 68 insertions(+), 64 deletions(-) diff --git a/packages/bsp/common/etc/default/armbian-motd.dpkg-dist b/packages/bsp/common/etc/default/armbian-motd.dpkg-dist index 612c6982e8fa..8708cfb9146a 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|^hassio" +HIDE_IP_PATTERN="^dummy0|^lo|^docker|^hassio|^br-*|^veth" 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/10-armbian-header b/packages/bsp/common/etc/update-motd.d/10-armbian-header index 1b5731c60608..02207b4cc900 100755 --- a/packages/bsp/common/etc/update-motd.d/10-armbian-header +++ b/packages/bsp/common/etc/update-motd.d/10-armbian-header @@ -27,54 +27,57 @@ VENDORTEMP="${VENDOR}" [[ -n $VENDORPRETTYNAME ]] && VENDOR="$VENDORPRETTYNAME" if [[ -f /etc/armbian-distribution-status ]]; then - . /etc/armbian-distribution-status - # Fina a way that works - [[ -f /etc/lsb-release ]] && DISTRIBUTION_CODENAME=$(grep CODENAME /etc/lsb-release | cut -d"=" -f2) - [[ -f /etc/lsb-release ]] && DISTRIBUTION_ID=$(grep DISTRIB_ID /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_ID" && -f /etc/os-release ]] && DISTRIBUTION_ID=$(grep "^ID" /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") - [[ -z "$DISTRIBUTION_ID" && -x /usr/bin/lsb_release ]] && DISTRIBUTION_ID=$(/usr/bin/lsb_release -i | cut -d":" -f2 | tr -d "\t") - # Read Armbian distribution status - DISTRIBUTION_STATUS=$(grep "^${DISTRIBUTION_CODENAME}" /etc/armbian-distribution-status | cut -d"=" -f2 | cut -d";" -f1) - - # Read upgrade possibilities on stable channel - filter=$(grep "supported" /etc/armbian-distribution-status | cut -d"=" -f1) - upgrade=$(for j in $filter; do - for i in $(grep "^${DISTRIBUTION_CODENAME}" /etc/armbian-distribution-status | cut -d";" -f2 | cut -d"=" -f2 | sed "s/,/ /g"); do - if [[ $i == $j ]]; then - echo $i - fi - done - done | tail -1) + . /etc/armbian-distribution-status + # Find a way that works + [[ -f /etc/lsb-release ]] && DISTRIBUTION_CODENAME=$(grep CODENAME /etc/lsb-release | cut -d"=" -f2) + [[ -f /etc/lsb-release ]] && DISTRIBUTION_ID=$(grep DISTRIB_ID /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_ID" && -f /etc/os-release ]] && DISTRIBUTION_ID=$(grep "^ID" /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") + [[ -z "$DISTRIBUTION_ID" && -x /usr/bin/lsb_release ]] && DISTRIBUTION_ID=$(/usr/bin/lsb_release -i | cut -d":" -f2 | tr -d "\t") + # Read Armbian distribution status + DISTRIBUTION_STATUS=$(grep "^${DISTRIBUTION_CODENAME}" /etc/armbian-distribution-status | cut -d"=" -f2 | cut -d";" -f1) + + # Read upgrade possibilities on stable channel + filter=$(grep "supported" /etc/armbian-distribution-status | cut -d"=" -f1) + upgrade=$(for j in $filter; do + for i in $(grep "^${DISTRIBUTION_CODENAME}" /etc/armbian-distribution-status | cut -d";" -f2 | cut -d"=" -f2 | sed "s/,/ /g"); do + if [[ $i == $j ]]; then + echo $i + fi + done + done | tail -1) fi [[ -f /etc/default/armbian-motd ]] && . /etc/default/armbian-motd for f in $MOTD_DISABLE; do - [[ $f == $THIS_SCRIPT ]] && exit 0 + [[ $f == $THIS_SCRIPT ]] && exit 0 done function get_wan_address() { - curl --connect-timeout 2 -s http://whatismyip.akamai.com/ + curl --connect-timeout 2 -s http://whatismyip.akamai.com/ } # get wan ip address function get_ip_addresses() { - local ips=() - for f in /sys/class/net/*; do - local intf=$(basename $f) - # match only interface names "dummy0" and "lo" - if [[ $intf =~ $HIDE_IP_PATTERN ]]; then - continue - else - local tmp=$(ip -4 addr show dev $intf | grep -v "$intf:avahi" | awk '/inet/ {print $2}' | cut -d'/' -f1 | uniq) - # add both name and IP - can be informative but becomes ugly with long persistent/predictable device names - #[[ -n $tmp ]] && ips+=("$intf: $tmp") - # add IP only - [[ -n $tmp ]] && ips+=("$tmp") - fi - done - echo "${ips[@]}" + local ipv4s=() + local ipv6s=() + + for f in /sys/class/net/*; do + local intf=$(basename $f) + # match only interface names + if [[ $intf =~ $HIDE_IP_PATTERN ]]; then + continue + else + local ipv4=$(ip -4 addr show dev $intf | grep -v "$intf:avahi" | awk '/inet/ {print $2}' | cut -d'/' -f1 | uniq) + local ipv6=$(ip -6 addr show dev $intf | grep -v "$intf:avahi" | awk '/inet6/ {print $2}' | cut -d'/' -f1 | uniq) + + [[ -n $ipv4 ]] && ipv4s+=("$ipv4") + [[ -n $ipv6 ]] && ipv6s+=("$ipv6") + fi + done + + echo "${ipv4s[@]}|${ipv6s[@]}" } # get_ip_addresses # Read Armbian kernel version @@ -92,63 +95,64 @@ echo -e " \e[0;92mv${VERSION}\x1B[0m for $BOARD_NAME running Armbian Linux \e[0; # render image and board type if [[ "$IMAGE_TYPE" != "stable" ]]; then - [[ "$IMAGE_TYPE" == "user-built" ]] && HARDWARE_STATUS="\e[0;91mDIY\x1B[0m (custom image)\x1B[0m" - [[ "$IMAGE_TYPE" == "nightly" ]] && HARDWARE_STATUS="\e[0;91mfor advanced users\x1B[0m (rolling release)\x1B[0m" + [[ "$IMAGE_TYPE" == "user-built" ]] && HARDWARE_STATUS="\e[0;91mDIY\x1B[0m (custom image)\x1B[0m" + [[ "$IMAGE_TYPE" == "nightly" ]] && HARDWARE_STATUS="\e[0;91mfor advanced users\x1B[0m (rolling release)\x1B[0m" else - [[ "$BOARD_TYPE" == "csc" || "$BOARD_TYPE" == "tvb" ]] && HARDWARE_STATUS="\e[0;91mDIY (community maintained)\x1B[0m" - [[ "$BOARD_TYPE" == "wip" ]] && HARDWARE_STATUS="\e[0;91mfor advanced users\x1B[0m (work in progress)\x1B[0m" - [[ "$BOARD_TYPE" == "eos" ]] && HARDWARE_STATUS="\e[0;91mend of life\x1B[0m" + [[ "$BOARD_TYPE" == "csc" || "$BOARD_TYPE" == "tvb" ]] && HARDWARE_STATUS="\e[0;91mDIY (community maintained)\x1B[0m" + [[ "$BOARD_TYPE" == "wip" ]] && HARDWARE_STATUS="\e[0;91mfor advanced users\x1B[0m (work in progress)\x1B[0m" + [[ "$BOARD_TYPE" == "eos" ]] && HARDWARE_STATUS="\e[0;91mend of life\x1B[0m" fi # render distribution status if [[ $DISTRIBUTION_STATUS == supported ]]; then - DISTRO_STATUS="\e[0;92mstable\e[0m ($DISTRIBUTION_CODENAME)" + DISTRO_STATUS="\e[0;92mstable\e[0m ($DISTRIBUTION_CODENAME)" elif [[ $DISTRIBUTION_STATUS == eos ]]; then - DISTRO_STATUS="\e[0;91mend of life\e[0m ($DISTRIBUTION_CODENAME)" + DISTRO_STATUS="\e[0;91mend of life\e[0m ($DISTRIBUTION_CODENAME)" else - DISTRO_STATUS="\e[0;93mrolling\e[0m ($DISTRIBUTION_CODENAME)" + DISTRO_STATUS="\e[0;93mrolling\e[0m ($DISTRIBUTION_CODENAME)" fi - # read packages update status NUM_UPDATES=0 NUM_UPDATES_ONHOLD=0 NUM_SECURITY_UPDATES=0 [[ -f /var/cache/apt/archives/updates.number ]] && . /var/cache/apt/archives/updates.number if [[ $NUM_UPDATES -gt 0 ]]; then - if apt-mark showhold | grep -q linux-image 2>/dev/null; then - UPDATE_STATUS="Kernel upgrade \e[0;91mdisabled\e[0m" - else - UPDATE_STATUS="Kernel upgrade \e[0;92menabled\e[0m" - fi - UPDATE_STATUS+=" and \e[1;92m$NUM_UPDATES\e[0m package" - # Cosmetic is important - [[ $NUM_UPDATES -gt 1 ]] && UPDATE_STATUS+="s" - UPDATE_STATUS+=" available for upgrade\e[0m " + if apt-mark showhold | grep -q linux-image 2>/dev/null; then + UPDATE_STATUS="Kernel upgrade \e[0;91mdisabled\e[0m" + else + UPDATE_STATUS="Kernel upgrade \e[0;92menabled\e[0m" + fi + UPDATE_STATUS+=" and \e[1;92m$NUM_UPDATES\e[0m package" + # Cosmetic is important + [[ $NUM_UPDATES -gt 1 ]] && UPDATE_STATUS+="s" + UPDATE_STATUS+=" available for upgrade\e[0m " fi echo "" # Display packages status if [[ -n $DISTRO_STATUS ]]; then - if [[ -n "${upgrade}" ]]; then - DISTRO_STATUS+=", possible distro upgrade ($upgrade)" - fi - echo -e " Packages: ${DISTRIBUTION_ID^} ${DISTRO_STATUS}" + if [[ -n "${upgrade}" ]]; then + DISTRO_STATUS+=", possible distro upgrade ($upgrade)" + fi + echo -e " Packages: ${DISTRIBUTION_ID^} ${DISTRO_STATUS}" fi # Display available updates if [[ -n $UPDATE_STATUS ]]; then - echo -e " Updates: $UPDATE_STATUS" + echo -e " Updates: $UPDATE_STATUS" fi # Display hardware support status if [[ -n $HARDWARE_STATUS ]]; then - echo -e " Support: $HARDWARE_STATUS" + echo -e " Support: $HARDWARE_STATUS" fi -echo -en " IP addresses: \x1B[93m(LAN)\x1B[0m \x1B[92m$ip_address\x1B[0m " + +IFS='|' read -r ipv4s ipv6s <<< "$ip_address" +echo -en " IP addresses: \x1B[93m(LAN)\x1B[0m IPv4: \x1B[92m${ipv4s// /, }\x1B[0m IPv6: \x1B[96m${ipv6s// /, }\x1B[0m" if [[ -n $wan_ip_address ]]; then -echo -e "\x1B[93m(WAN)\x1B[0m $wan_ip_address" + echo -e " \x1B[93m(WAN)\x1B[0m $wan_ip_address" fi echo "" From a613f2f2897097ab5a13731e229588eb6ffc1c66 Mon Sep 17 00:00:00 2001 From: SuperKali Date: Wed, 2 Oct 2024 13:22:50 +0000 Subject: [PATCH 2/3] Revert default hide interfaces --- packages/bsp/common/etc/default/armbian-motd.dpkg-dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bsp/common/etc/default/armbian-motd.dpkg-dist b/packages/bsp/common/etc/default/armbian-motd.dpkg-dist index 8708cfb9146a..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|^hassio|^br-*|^veth" +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 From ac91755bbdc7084953b726f88a3f7f4ba084160e Mon Sep 17 00:00:00 2001 From: SuperKali Date: Fri, 4 Oct 2024 05:49:37 +0000 Subject: [PATCH 3/3] Formatting from spaces to tabs --- .../etc/update-motd.d/10-armbian-header | 130 +++++++++--------- 1 file changed, 65 insertions(+), 65 deletions(-) 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 02207b4cc900..b4a35e590a1c 100755 --- a/packages/bsp/common/etc/update-motd.d/10-armbian-header +++ b/packages/bsp/common/etc/update-motd.d/10-armbian-header @@ -27,57 +27,57 @@ VENDORTEMP="${VENDOR}" [[ -n $VENDORPRETTYNAME ]] && VENDOR="$VENDORPRETTYNAME" if [[ -f /etc/armbian-distribution-status ]]; then - . /etc/armbian-distribution-status - # Find a way that works - [[ -f /etc/lsb-release ]] && DISTRIBUTION_CODENAME=$(grep CODENAME /etc/lsb-release | cut -d"=" -f2) - [[ -f /etc/lsb-release ]] && DISTRIBUTION_ID=$(grep DISTRIB_ID /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_ID" && -f /etc/os-release ]] && DISTRIBUTION_ID=$(grep "^ID" /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") - [[ -z "$DISTRIBUTION_ID" && -x /usr/bin/lsb_release ]] && DISTRIBUTION_ID=$(/usr/bin/lsb_release -i | cut -d":" -f2 | tr -d "\t") - # Read Armbian distribution status - DISTRIBUTION_STATUS=$(grep "^${DISTRIBUTION_CODENAME}" /etc/armbian-distribution-status | cut -d"=" -f2 | cut -d";" -f1) - - # Read upgrade possibilities on stable channel - filter=$(grep "supported" /etc/armbian-distribution-status | cut -d"=" -f1) - upgrade=$(for j in $filter; do - for i in $(grep "^${DISTRIBUTION_CODENAME}" /etc/armbian-distribution-status | cut -d";" -f2 | cut -d"=" -f2 | sed "s/,/ /g"); do - if [[ $i == $j ]]; then - echo $i - fi - done - done | tail -1) + . /etc/armbian-distribution-status + # Find a way that works + [[ -f /etc/lsb-release ]] && DISTRIBUTION_CODENAME=$(grep CODENAME /etc/lsb-release | cut -d"=" -f2) + [[ -f /etc/lsb-release ]] && DISTRIBUTION_ID=$(grep DISTRIB_ID /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_ID" && -f /etc/os-release ]] && DISTRIBUTION_ID=$(grep "^ID" /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") + [[ -z "$DISTRIBUTION_ID" && -x /usr/bin/lsb_release ]] && DISTRIBUTION_ID=$(/usr/bin/lsb_release -i | cut -d":" -f2 | tr -d "\t") + # Read Armbian distribution status + DISTRIBUTION_STATUS=$(grep "^${DISTRIBUTION_CODENAME}" /etc/armbian-distribution-status | cut -d"=" -f2 | cut -d";" -f1) + + # Read upgrade possibilities on stable channel + filter=$(grep "supported" /etc/armbian-distribution-status | cut -d"=" -f1) + upgrade=$(for j in $filter; do + for i in $(grep "^${DISTRIBUTION_CODENAME}" /etc/armbian-distribution-status | cut -d";" -f2 | cut -d"=" -f2 | sed "s/,/ /g"); do + if [[ $i == $j ]]; then + echo $i + fi + done + done | tail -1) fi [[ -f /etc/default/armbian-motd ]] && . /etc/default/armbian-motd for f in $MOTD_DISABLE; do - [[ $f == $THIS_SCRIPT ]] && exit 0 + [[ $f == $THIS_SCRIPT ]] && exit 0 done function get_wan_address() { - curl --connect-timeout 2 -s http://whatismyip.akamai.com/ + curl --connect-timeout 2 -s http://whatismyip.akamai.com/ } # get wan ip address function get_ip_addresses() { - local ipv4s=() - local ipv6s=() - - for f in /sys/class/net/*; do - local intf=$(basename $f) - # match only interface names - if [[ $intf =~ $HIDE_IP_PATTERN ]]; then - continue - else - local ipv4=$(ip -4 addr show dev $intf | grep -v "$intf:avahi" | awk '/inet/ {print $2}' | cut -d'/' -f1 | uniq) - local ipv6=$(ip -6 addr show dev $intf | grep -v "$intf:avahi" | awk '/inet6/ {print $2}' | cut -d'/' -f1 | uniq) - - [[ -n $ipv4 ]] && ipv4s+=("$ipv4") - [[ -n $ipv6 ]] && ipv6s+=("$ipv6") - fi - done - - echo "${ipv4s[@]}|${ipv6s[@]}" + local ipv4s=() + local ipv6s=() + + for f in /sys/class/net/*; do + local intf=$(basename $f) + # match only interface names + if [[ $intf =~ $HIDE_IP_PATTERN ]]; then + continue + else + local ipv4=$(ip -4 addr show dev $intf | grep -v "$intf:avahi" | awk '/inet/ {print $2}' | cut -d'/' -f1 | uniq) + local ipv6=$(ip -6 addr show dev $intf | grep -v "$intf:avahi" | awk '/inet6/ {print $2}' | cut -d'/' -f1 | uniq) + + [[ -n $ipv4 ]] && ipv4s+=("$ipv4") + [[ -n $ipv6 ]] && ipv6s+=("$ipv6") + fi + done + + echo "${ipv4s[@]}|${ipv6s[@]}" } # get_ip_addresses # Read Armbian kernel version @@ -95,64 +95,64 @@ echo -e " \e[0;92mv${VERSION}\x1B[0m for $BOARD_NAME running Armbian Linux \e[0; # render image and board type if [[ "$IMAGE_TYPE" != "stable" ]]; then - [[ "$IMAGE_TYPE" == "user-built" ]] && HARDWARE_STATUS="\e[0;91mDIY\x1B[0m (custom image)\x1B[0m" - [[ "$IMAGE_TYPE" == "nightly" ]] && HARDWARE_STATUS="\e[0;91mfor advanced users\x1B[0m (rolling release)\x1B[0m" + [[ "$IMAGE_TYPE" == "user-built" ]] && HARDWARE_STATUS="\e[0;91mDIY\x1B[0m (custom image)\x1B[0m" + [[ "$IMAGE_TYPE" == "nightly" ]] && HARDWARE_STATUS="\e[0;91mfor advanced users\x1B[0m (rolling release)\x1B[0m" else - [[ "$BOARD_TYPE" == "csc" || "$BOARD_TYPE" == "tvb" ]] && HARDWARE_STATUS="\e[0;91mDIY (community maintained)\x1B[0m" - [[ "$BOARD_TYPE" == "wip" ]] && HARDWARE_STATUS="\e[0;91mfor advanced users\x1B[0m (work in progress)\x1B[0m" - [[ "$BOARD_TYPE" == "eos" ]] && HARDWARE_STATUS="\e[0;91mend of life\x1B[0m" + [[ "$BOARD_TYPE" == "csc" || "$BOARD_TYPE" == "tvb" ]] && HARDWARE_STATUS="\e[0;91mDIY (community maintained)\x1B[0m" + [[ "$BOARD_TYPE" == "wip" ]] && HARDWARE_STATUS="\e[0;91mfor advanced users\x1B[0m (work in progress)\x1B[0m" + [[ "$BOARD_TYPE" == "eos" ]] && HARDWARE_STATUS="\e[0;91mend of life\x1B[0m" fi # render distribution status if [[ $DISTRIBUTION_STATUS == supported ]]; then - DISTRO_STATUS="\e[0;92mstable\e[0m ($DISTRIBUTION_CODENAME)" + DISTRO_STATUS="\e[0;92mstable\e[0m ($DISTRIBUTION_CODENAME)" elif [[ $DISTRIBUTION_STATUS == eos ]]; then - DISTRO_STATUS="\e[0;91mend of life\e[0m ($DISTRIBUTION_CODENAME)" + DISTRO_STATUS="\e[0;91mend of life\e[0m ($DISTRIBUTION_CODENAME)" else - DISTRO_STATUS="\e[0;93mrolling\e[0m ($DISTRIBUTION_CODENAME)" + DISTRO_STATUS="\e[0;93mrolling\e[0m ($DISTRIBUTION_CODENAME)" fi + # read packages update status NUM_UPDATES=0 NUM_UPDATES_ONHOLD=0 NUM_SECURITY_UPDATES=0 [[ -f /var/cache/apt/archives/updates.number ]] && . /var/cache/apt/archives/updates.number if [[ $NUM_UPDATES -gt 0 ]]; then - if apt-mark showhold | grep -q linux-image 2>/dev/null; then - UPDATE_STATUS="Kernel upgrade \e[0;91mdisabled\e[0m" - else - UPDATE_STATUS="Kernel upgrade \e[0;92menabled\e[0m" - fi - UPDATE_STATUS+=" and \e[1;92m$NUM_UPDATES\e[0m package" - # Cosmetic is important - [[ $NUM_UPDATES -gt 1 ]] && UPDATE_STATUS+="s" - UPDATE_STATUS+=" available for upgrade\e[0m " + if apt-mark showhold | grep -q linux-image 2>/dev/null; then + UPDATE_STATUS="Kernel upgrade \e[0;91mdisabled\e[0m" + else + UPDATE_STATUS="Kernel upgrade \e[0;92menabled\e[0m" + fi + UPDATE_STATUS+=" and \e[1;92m$NUM_UPDATES\e[0m package" + # Cosmetic is important + [[ $NUM_UPDATES -gt 1 ]] && UPDATE_STATUS+="s" + UPDATE_STATUS+=" available for upgrade\e[0m " fi echo "" # Display packages status if [[ -n $DISTRO_STATUS ]]; then - if [[ -n "${upgrade}" ]]; then - DISTRO_STATUS+=", possible distro upgrade ($upgrade)" - fi - echo -e " Packages: ${DISTRIBUTION_ID^} ${DISTRO_STATUS}" + if [[ -n "${upgrade}" ]]; then + DISTRO_STATUS+=", possible distro upgrade ($upgrade)" + fi + echo -e " Packages: ${DISTRIBUTION_ID^} ${DISTRO_STATUS}" fi # Display available updates if [[ -n $UPDATE_STATUS ]]; then - echo -e " Updates: $UPDATE_STATUS" + echo -e " Updates: $UPDATE_STATUS" fi # Display hardware support status if [[ -n $HARDWARE_STATUS ]]; then - echo -e " Support: $HARDWARE_STATUS" + echo -e " Support: $HARDWARE_STATUS" fi - IFS='|' read -r ipv4s ipv6s <<< "$ip_address" echo -en " IP addresses: \x1B[93m(LAN)\x1B[0m IPv4: \x1B[92m${ipv4s// /, }\x1B[0m IPv6: \x1B[96m${ipv6s// /, }\x1B[0m" if [[ -n $wan_ip_address ]]; then - echo -e " \x1B[93m(WAN)\x1B[0m $wan_ip_address" +echo -e "\x1B[93m(WAN)\x1B[0m $wan_ip_address" fi echo ""