User Tools

Site Tools


doc:techref:uci

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
doc:techref:uci [2013/01/26 14:12]
whuang formatting
doc:techref:uci [2013/09/04 15:58] (current)
peteruithoven
Line 6: Line 6:
 git clone git://​nbd.name/​uci.git git clone git://​nbd.name/​uci.git
 </​code>​ </​code>​
 +  * This is the Technical Reference. Please see **[[doc/​uci|UCI (Unified Configuration Interface) – Usage]]**
  
 ==== What is UCI? ==== ==== What is UCI? ====
Line 78: Line 79:
 If the callback function returns ''​false''​ [NB: __not__ ''​nil''​!],​ ''​foreach()''​ will terminate at that point without iterating over any remaining sections. If the callback function returns ''​false''​ [NB: __not__ ''​nil''​!],​ ''​foreach()''​ will terminate at that point without iterating over any remaining sections.
 ''​foreach()''​ returns ''​true''​ if at least one section exists and the callback function didn't raise an error for it; ''​false''​ otherwise. ''​foreach()''​ returns ''​true''​ if at least one section exists and the callback function didn't raise an error for it; ''​false''​ otherwise.
 +<code lua>​x:​reorder("​config",​ "​sectionname",​ position)</​code>​
 +Move a section to another position. Position starts at 0. 
 +This is for example handy to change the wireless config order (changing priority). ​
 <code lua>​x:​revert("​config"​)</​code>​ <code lua>​x:​revert("​config"​)</​code>​
 discards any changes made to the configuration,​ that have not yet been committed discards any changes made to the configuration,​ that have not yet been committed
Line 146: Line 150:
  
 ===== Usage outside of  OpenWrt ===== ===== Usage outside of  OpenWrt =====
-If you want to use the libuci apart from OpenWrt (for e.g. you are developing an application on your host computer)+If you want to use the libuci apart from OpenWrt (for e.g. you are developing an application ​in C on your host computer) ​then prepare as follows:
  
 Grab the source. Grab the source.
Line 154: Line 158:
 <​code>​cd uci/; cmake -D BUILD_LUA:​BOOL=OFF .</​code>​ <​code>​cd uci/; cmake -D BUILD_LUA:​BOOL=OFF .</​code>​
  
-Build uci: +Build and install ​uci als root (this will install uci into /​usr/​local/,​ see this thread on how to install and use uci without root permissions in your home directory: https://​forum.openwrt.org/​viewtopic.php?​id=40547)
-<​code>​make</​code>​+<​code>​make ​install</​code>​
  
 +Open /​etc/​ld.so.conf and add the place where you installed the uci library:
 +<​code>​vi /​etc/​ld.so.conf</​code>​
 +
 +Add this line somewhere to /​etc/​ld.so.conf
 +<​code>/​usr/​local/​lib</​code>​
 +
 +Execute ldconfig as root to apply the changes to /​etc/​ld.so.conf
 +<​code>​ldconfig</​code>​
 +
 +To compile your application you have to link it against the uci library. Append -luci in your Makefile:
 +<​code>​$(CC) test.o -o test -luci</​code>​
 +
 +And examples on how to use UCI in C can be found in this thread: https://​forum.openwrt.org/​viewtopic.php?​pid=183335#​p183335
 +To get more examples look into the source directory of uci which you got by git clone and open cli.c or ucimap-example.c
  
 ===== Functioning ===== ===== Functioning =====
doc/techref/uci.1359205924.txt.bz2 · Last modified: 2013/01/26 14:12 by whuang