Changeset 31937


Ignore:
Timestamp:
2012-05-28T05:24:56+02:00 (6 years ago)
Author:
jow
Message:

[package] base-files: add network_get_device() to network.sh

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/base-files/files/lib/functions/network.sh

    r31935 r31937  
    4040network_get_subnet()  { __network_ipaddr "$1" "$2" 4 1; } 
    4141network_get_subnet6() { __network_ipaddr "$1" "$2" 6 1; } 
     42 
     43 
     44network_get_device() 
     45{ 
     46        local __var="$1" 
     47        local __iface="$2" 
     48 
     49        local __tmp="$(ubus call network.interface."$__iface" status 2>/dev/null)" 
     50        [ -n "$__tmp" ] || return 1 
     51 
     52        json_load "$__tmp" 
     53        json_get_var "$__var" device 
     54 
     55        return 0 
     56} 
Note: See TracChangeset for help on using the changeset viewer.