rewrite json_get_vars to jsonfilter

This commit is contained in:
Christof Schulze 2016-12-06 22:05:29 +01:00
parent f449e31298
commit d1110f3cdc

View File

@ -1,22 +1,18 @@
#!/bin/sh
. /usr/share/libubox/jshn.sh
. /lib/functions/service.sh
DEVLIST=/var/run/gluon-respondd.devs
ifname_to_dev () {
json_load "$(ubus call network.interface.$1 status)"
json_get_var dev device
echo "$dev"
ifstatus client "$1"|jsonfilter -e "@.device"
}
case "$ACTION" in
ifup)
DEVICE="$(ifname_to_dev "$INTERFACE")"
[ "$DEVICE" == $(cat /lib/gluon/respondd/client.dev) ] &&
[ "$DEVICE" != "$(cat /lib/gluon/respondd/client.dev)" ] ||
/etc/init.d/gluon-respondd restart_if_running &
;;
esac