I am configuring a router running OpenWRT, but I am struggling to understand how to use the uci command (Unified Configuration Interface) to inspect an existing configuration file. I would like to automate this configuration in a shell script.
Take for example the firewall configuration at /etc/config/firewall which is 195 long, so a bit difficult to inspect with cat.
There are various rules, take the first one with:
root@OpenWrt:/etc/config# grep -B1 -A6 'Allow-DHCP-Renew' /etc/config/firewall
config rule
option name Allow-DHCP-Renew
option src wan
option proto udp
option dest_port 68
option target ACCEPT
option family ipv4
root@OpenWrt:/etc/config#
I can inspect the various fields of this first rule (@rule[0]) e.g. the field name with:
root@OpenWrt:/etc/config# uci get firewall.@rule[0].name
Allow-DHCP-Renew
root@OpenWrt:/etc/config#
But I can not see the whole rule as output, I've tried with uci get firewall.@rule[0].* but it's not the right syntax.
There is no manual for uci (man uci), so I am not sure where to find the information on how to use that command.
Is this "group get" possible at all?