base-files: add helper functions for adding wlan device entries to board.json
[openwrt/staging/noltari.git] / package / base-files / files / lib / functions / uci-defaults.sh
index 86f16b51254c9d654987884d0e238527a5bd3850..a37e8cf82416d3afe7637c61150d7aee8f2399f5 100644 (file)
@@ -646,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})"