mirror of
https://github.com/DrHo1y/orangepi-build.git
synced 2026-11-18 16:12:47 +07:00
Bump to next branch
Host: Ubuntu 21.04
This commit is contained in:
@@ -1071,26 +1071,26 @@ NetworkMonitorMode() {
|
||||
|
||||
# Allow orangepimonitor to return back to orangepi-config
|
||||
trap "echo ; exit 0" 0 1 2 3 15
|
||||
timerStart
|
||||
kickAllStatsDown
|
||||
|
||||
# Count interfaces - multiple routes causing interfaces to show up more than once, filtering...
|
||||
ifacecount=$(route -n | egrep UG | egrep -o "[a-zA-Z0-9]*$" | sort | uniq)
|
||||
ifacecount=$(route -n | egrep UG | egrep -o '[^ ]*$' | sort | uniq)
|
||||
# If there are two ore more interfaces detected open a dynamic dialog box to select which to monitor
|
||||
if [ "$(echo -e $ifacecount | tr ' ' '\n' | wc -l)" -gt 1 ]; then
|
||||
ifacemenu=$(route -n | egrep UG | egrep -o "[a-zA-Z0-9]*$" | sort | uniq | awk '{a[$1]=$1}END{for(i in a)printf i" "a[i]" "}')
|
||||
ifacemenu=$(route -n | egrep UG | egrep -o '[^ ]*$' | sort | uniq | awk '{a[$1]=$1}END{for(i in a)printf i" "a[i]" "}')
|
||||
ifacefunc() {
|
||||
dialog --backtitle "Interface selector" \
|
||||
--title "Multiple network interfaces detected" \
|
||||
--menu "Choose which interface to monitor:" \
|
||||
15 50 $(route -n | egrep UG | egrep -o "[a-zA-Z0-9]*$" | sort | uniq | wc -l) \
|
||||
15 50 $(route -n | egrep UG | egrep -o '[^ ]*$' | sort | uniq | wc -l) \
|
||||
$(echo $ifacemenu) 2>&1 >$(tty)
|
||||
}
|
||||
iface=$(ifacefunc)
|
||||
else
|
||||
# Use default behavior if one interface is found only
|
||||
iface=$(route -n | egrep UG | egrep -o "[a-zA-Z0-9]*$")
|
||||
iface=$(route -n | egrep UG | egrep -o '[^ ]*$')
|
||||
fi
|
||||
timerStart
|
||||
kickAllStatsDown
|
||||
|
||||
printf "\nruntime network statistics: $(uname -n)\n"
|
||||
printf "network interface: $(echo $iface)\n"
|
||||
|
||||
Reference in New Issue
Block a user