Modify the mechanism for showing IP address in 30-armbian-sysinfo
Exclude "dummy0" and "lo" interface, thus the IP address for all other interface(include those having customized name) can be properly displayed
This commit is contained in:
parent
a2b3dc2afc
commit
a84da70535
@ -6,7 +6,7 @@
|
||||
|
||||
MOTD_DISABLE=""
|
||||
ONE_WIRE=""
|
||||
SHOW_IP_PATTERN="^bond.*|^[ewr].*|^br.*|^lt.*|^umts.*|^lan.*"
|
||||
HIDE_IP_PATTERN="^dummy0|^lo"
|
||||
PRIMARY_INTERFACE="$(ls -1 /sys/class/net/ | grep -v lo | egrep "enp|eth" | head -1)"
|
||||
PRIMARY_DIRECTION="rx"
|
||||
STORAGE=/dev/sda1
|
||||
|
||||
@ -19,7 +19,7 @@ MOTD_DISABLE=""
|
||||
PRIMARY_INTERFACE="eth0"
|
||||
PRIMARY_DIRECTION="rx"
|
||||
STORAGE=/dev/sda1
|
||||
SHOW_IP_PATTERN="^bond.*|^[ewr].*|^br.*|^lt.*|^umts.*|^lan.*"
|
||||
HIDE_IP_PATTERN="^dummy0|^lo"
|
||||
CPU_TEMP_LIMIT=60
|
||||
# Temperature offset in Celcius degrees
|
||||
CPU_TEMP_OFFSET=0
|
||||
@ -134,8 +134,10 @@ function get_ip_addresses() {
|
||||
local ips=()
|
||||
for f in /sys/class/net/*; do
|
||||
local intf=$(basename $f)
|
||||
# match only interface names starting with e (Ethernet), br (bridge), w (wireless), r (some Ralink drivers use ra<number> format)
|
||||
if [[ $intf =~ $SHOW_IP_PATTERN ]]; then
|
||||
# match only interface names "dummy0" and "lo"
|
||||
if [[ $intf =~ $HIDE_IP_PATTERN ]]; then
|
||||
continue
|
||||
else
|
||||
local tmp=$(ip -4 addr show dev $intf | awk '/inet/ {print $2}' | cut -d'/' -f1)
|
||||
# add both name and IP - can be informative but becomes ugly with long persistent/predictable device names
|
||||
#[[ -n $tmp ]] && ips+=("$intf: $tmp")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user