More motd related fixed (#2848)

Fixing error when we don't have etherned
This commit is contained in:
Igor Pečovnik 2021-05-23 18:25:21 +02:00 committed by GitHub
parent e78cb4ce2a
commit f7c2dc2bc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@
MOTD_DISABLE=""
ONE_WIRE=""
SHOW_IP_PATTERN="^bond.*|^[ewr].*|^br.*|^lt.*|^umts.*|^lan.*"
PRIMARY_INTERFACE="$(ls -1 /sys/class/net/ | grep -v lo | egrep "enp|eth" | sed -n -e 'H;${x;s/\n/+/g;s/^+//;p;}')"
PRIMARY_INTERFACE="$(ls -1 /sys/class/net/ | grep -v lo | egrep "enp|eth" | head -1)"
PRIMARY_DIRECTION="rx"
STORAGE=/dev/sda1

View File

@ -233,7 +233,7 @@ display "Battery" "$battery_percent" "20" "1" "%" "$status_battery_text" ; a=$((
(( $a > 0 )) && echo "" # new line only if some value is displayed
line=0
if [[ $(command -v vnstat) ]]; then
if [[ $(command -v vnstat) && -n $PRIMARY_INTERFACE ]]; then
traffic=$(vnstat -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/')