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