forked from freifunk-franken/firmware
nodewatcher.d: Tiny cosmetic improvements
This applies some tiny improvements to just-moved nodewatcher.d code: - Remove comments about obvious things - Introduce newlines to make code easier to read - Use shorter conditional syntax for easy cases Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Reviewed-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
parent
1c3243dd18
commit
18e00a4e70
|
@ -7,7 +7,7 @@ debug() {
|
|||
}
|
||||
|
||||
debug "$(date): Collecting information from batman advanced and its interfaces"
|
||||
#B.A.T.M.A.N. advanced
|
||||
|
||||
if [ -f /sys/module/batman_adv/version ]; then
|
||||
for iface in $(batctl if | sed 's/ //'); do
|
||||
status=${iface##*:}
|
||||
|
|
|
@ -12,25 +12,21 @@ debug() {
|
|||
inArray() {
|
||||
local value
|
||||
for value in $1; do
|
||||
if [ "$value" = "$2" ]; then
|
||||
return 0
|
||||
fi
|
||||
[ "$value" = "$2" ] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
debug "$(date): Collecting information from network interfaces"
|
||||
|
||||
#Get interfaces
|
||||
interface_data=""
|
||||
#Loop interfaces
|
||||
#for entry in $IFACES; do
|
||||
|
||||
# Loop through interfaces: for entry in $IFACES; do
|
||||
for filename in $(grep 'up\|unknown' /sys/class/net/*/operstate); do
|
||||
ifpath=${filename%/operstate*}
|
||||
iface=${ifpath#/sys/class/net/}
|
||||
if inArray "$IFACEBLACKLIST" "$iface"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
inArray "$IFACEBLACKLIST" "$iface" && continue
|
||||
|
||||
#Get interface data for whitelisted interfaces
|
||||
# shellcheck disable=SC2016
|
||||
|
|
|
@ -9,8 +9,8 @@ debug() {
|
|||
(>&2 echo "$1")
|
||||
}
|
||||
|
||||
#Get system data from other locations
|
||||
debug "$(date): Collecting basic system status data"
|
||||
|
||||
hostname="$(cat /proc/sys/kernel/hostname)"
|
||||
mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }' /sys/class/net/br-mesh/address 2>/dev/null)
|
||||
[ "$hostname" = "OpenWrt" ] && hostname="$mac"
|
||||
|
|
Loading…
Reference in New Issue