diff options
author | Christian Marangi <ansuelsmth@gmail.com> | 2023-11-09 15:11:50 +0100 |
---|---|---|
committer | Christian Marangi <ansuelsmth@gmail.com> | 2023-11-10 12:30:33 +0100 |
commit | da7ad229311e6c68b023550f383d932dfd62d13b (patch) | |
tree | 9e5ce994c4386928a8b3665e611c9ea2087d2889 /package/base-files/files/lib | |
parent | 1714087442bb61591fe60a375f39b39abd657e25 (diff) |
base-files: generalize ucidef_set_network_device
Generalize ucidef_set_network_device functions to use a more generic
_ucidef_set_network_device_common that takes as args the option and the
value to apply instead of hardcoding.
This is to reduce duplicated code in preparation for addition of
additional option for board.d usage.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Diffstat (limited to 'package/base-files/files/lib')
-rw-r--r-- | package/base-files/files/lib/functions/uci-defaults.sh | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index 6f395ec24b..d40f4354ad 100644 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -106,20 +106,20 @@ ucidef_set_bridge_mac() { json_select .. } -ucidef_set_network_device_mac() { +_ucidef_set_network_device_common() { json_select_object "network_device" json_select_object "${1}" - json_add_string macaddr "${2}" + json_add_string "${2}" "${3}" json_select .. json_select .. } +ucidef_set_network_device_mac() { + _ucidef_set_network_device_common $1 macaddr $2 +} + ucidef_set_network_device_path() { - json_select_object "network_device" - json_select_object "$1" - json_add_string path "$2" - json_select .. - json_select .. + _ucidef_set_network_device_common $1 path $2 } _ucidef_add_switch_port() { |