[luci] Getting UCI configuration data

Jo-Philipp Wich xm at subsignal.org
Wed Jul 20 15:39:19 CEST 2011


Hi.

> How come the "system" section is anonymous? If the first parameter
> relates to the config file, second to the section in the file and
> third the variable, where does the anonymity come from?

"Anonymous" sections in UCI are sections that carry no explicit name so
the library will autogenerate one which is not known in advance:

  cat /etc/config/test:
  config foo bar
    option baz 1

 -> test.bar.baz=1


  cat /etc/config/test2:
  config foo
    option baz 1

 -> test2.???.baz=1


The only way to determine "???" is to iterate over all sections of type
"foo" to find the ID of the first one.

Why it was done that way... I don't know. Its a legacy from OpenWrt and
due to backwards compatibility reasons it was never changed.

> Is it because you could have multiple "system" sections in the
> "system" config file?

Theoretically yes, though the additional ones are most likely just
ignored by the init scripts.

~ Jow


More information about the luci mailing list