base-files: fix wrong ucidef_set_network_device_mac network-device entry
[openwrt/openwrt.git] / package / base-files / files / lib / functions / uci-defaults.sh
index 02882f43ca4ed719a1f84144c1d8ea67fa7f1553..6f395ec24b2a4ec6236d256e05e6a56faa81c91c 100644 (file)
@@ -96,7 +96,7 @@ ucidef_set_interfaces_lan_wan() {
 
 ucidef_set_bridge_device() {
        json_select_object bridge
-       json_add_string name "${1:switch0}"
+       json_add_string name "${1:-switch0}"
        json_select ..
 }
 
@@ -107,13 +107,21 @@ ucidef_set_bridge_mac() {
 }
 
 ucidef_set_network_device_mac() {
-       json_select_object "network-device"
+       json_select_object "network_device"
        json_select_object "${1}"
        json_add_string macaddr "${2}"
        json_select ..
        json_select ..
 }
 
+ucidef_set_network_device_path() {
+       json_select_object "network_device"
+       json_select_object "$1"
+       json_add_string path "$2"
+       json_select ..
+       json_select ..
+}
+
 _ucidef_add_switch_port() {
        # inherited: $num $device $need_tag $want_untag $role $index $prev_role
        # inherited: $n_cpu $n_ports $n_vlan $cpu0 $cpu1 $cpu2 $cpu3 $cpu4 $cpu5
@@ -418,6 +426,15 @@ ucidef_set_led_default() {
        json_select ..
 }
 
+ucidef_set_led_heartbeat() {
+       _ucidef_set_led_common "$1" "$2" "$3"
+
+       json_add_string trigger heartbeat
+       json_select ..
+
+       json_select ..
+}
+
 ucidef_set_led_gpio() {
        local gpio="$4"
        local inverted="$5"
@@ -629,6 +646,21 @@ ucidef_set_ntpserver() {
        json_select ..
 }
 
+ucidef_add_wlan() {
+       local path="$1"; shift
+
+       ucidef_wlan_idx=${ucidef_wlan_idx:-0}
+
+       json_select_object wlan
+       json_select_object "wl$ucidef_wlan_idx"
+       json_add_string path "$path"
+       json_add_fields "$@"
+       json_select ..
+       json_select ..
+
+       ucidef_wlan_idx="$((ucidef_wlan_idx + 1))"
+}
+
 board_config_update() {
        json_init
        [ -f ${CFG} ] && json_load "$(cat ${CFG})"