[Solved] System Configuration through UCI

I am usng TP-Link TD-W8980 v1 with latest Openwrt v18.06.1. I am trying to create a script-based configuration to set some configuration options. I am able to change wireless and network configuration pretty easily but when it comes to system configuration like setting the hostname of the router, I have no idea how to continue.

In /etc/config/system there is a config system portion which includes options that I need to set/change. But I am not able to access those options somehow. Furthermore when I tried LuCI to change those it showed commands like system.cfg01e48a.hostname=xxxx. Now what is cfg01e48a? Is it system configuration portion? Will it change every time I flash a new firmware? As I need a long-term script to change configuration I would like to have a hard-coded configuration name. Thanks

Secondly, I would like to know how can I change configuration in /etc/opkg.conf programmatically? I can sure edit the file but cant seem to set/change it through UCI. Is there anyway to do it?

I found out from documentation that I can use uci set system.@system[0].hostname=xxxx to set values. So problem solved.

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