I put together a small procd script that builds a command line from a config script to help me learn a bit more about procd under OpenWrt and kill another bird with the same stone by automating a common task.
Got it working ok with a single config. Changed logic a bit to config_foreach <function> $1
where $1 holds variable passed by command line, added a second config section, and that worked out as well. Soooo, I set up some shell aliases, and added the remaining sections to the config.
Here’s where the problem comes into play. For reference, the config structure is:
Config wan
option <name> value
.
.
.
config br-lan
option <name> value
.
.
.
I had hoped to use the section value (br-lan, wan, vpn0) to populate the interface name into the script generated command, but for some reason br-lan evaluates to section=cfg??????, while all the other sections evaluate properly - wan=wan, vpn0=vpn0.
I can work around it by adding an otherwise redundant option interface
to the config, but really just would like to know why the - in br-lan breaks things.