-#!/bin/ash
-
. /lib/functions.sh
. /usr/share/libubox/jshn.sh
[ -n "$opt" -a -n "$val" ] || break
- json_add_string "$opt" "$val"
+ [ "$opt" = "ifname" -a "$val" != "${val/ //}" ] && {
+ json_select_array "ports"
+ for e in $val; do json_add_string "" "$e"; done
+ json_close_array
+ } || {
+ json_add_string "$opt" "$val"
+ }
done
if ! json_is_a protocol string; then
json_select ..
}
+ucidef_set_compat_version() {
+ json_select_object system
+ json_add_string compat_version "${1:-1.0}"
+ json_select ..
+}
+
ucidef_set_interface_lan() {
ucidef_set_interface "lan" ifname "$1" protocol "${2:-static}"
}
ucidef_set_interface_wan "$wan_if"
}
+ucidef_set_bridge_device() {
+ json_select_object bridge
+ json_add_string name "${1:switch0}"
+ json_select ..
+}
+
+ucidef_set_bridge_mac() {
+ json_select_object bridge
+ json_add_string macaddr "${1}"
+ json_select ..
+}
+
+ucidef_set_network_device_mac() {
+ json_select_object "network-device"
+ json_select_object "${1}"
+ json_add_string macaddr "${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
}
ucidef_set_led_ide() {
- _ucidef_set_led_trigger "$1" "$2" "$3" ide-disk
+ _ucidef_set_led_trigger "$1" "$2" "$3" disk-activity
}
ucidef_set_led_netdev() {
json_select_object gpioswitch
json_select_object "$cfg"
json_add_string name "$name"
- json_add_int pin "$pin"
+ json_add_string pin "$pin"
json_add_int default "$default"
json_select ..
json_select ..
}
board_config_flush() {
- json_dump -i > /tmp/.board.json
- mv /tmp/.board.json ${CFG}
+ json_dump -i -o ${CFG}
}