UCI set for a file in a different directory other than /etc/config

I have a temporary config file in /tmp/abc . soft link for the same has been created under /etc/config/abc.

Contents of /tmp/abc file.

config test
     option xyz '12'

uci set of 'xyz' option is not updating the value in the /tmp/abc config file.

util.ubus() is being used for setting the value.

util.ubus("uci", "set", { config = 'abc', type = 'test', values = { xyx= '14'}})

https://openwrt.org/docs/guide-user/base-system/uci#usage
Uci command I think you're looking for the -p option.

I don't know the equivalent in ubus

Just tried the uci set using the command line utility

uci set -p /tmp/ abc.test.xyz=20

Did not work and responded with the uci usage prompt.

I believe it should be uci -p /tmp/ set abc.test.xyz=20.

Had to use the below command

uci -p /tmp/ set abc.@test[0].xyz=20

Able to set and the updated value is shown using uci changes.
When i tried to commit the chnages using uci commit, it rejects with uci: I/O error .

1 Like

-c set the search path for config files (default: /etc/config)

You also need to use this flag in uci commit

1 Like

it works !!

uci -p /tmp/ set abc.@test[0].xyz=20
uci -c /tmp/ commit

Is there a way where we can specify multiple paths of config files and continue to use the generic uci set and uci commit command without -c flag?

I think you should use -c here: -p is for config change files, which is something else I believe.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.