Copy & Paste from IRC logs (http://openwrt.org/logs/openwrt.log.20080831):

[12:19] <Yanira> fback: so, be happy. don't expect to much yet
[12:19] <Yanira> nbd: why do i need 'set'?
[12:19] <Yanira> nbd: lets take a example config file...
[12:19] <Yanira> an existing one
[12:20] <nbd> the syntax is always uci <command> [<arguments>]
[12:20] <nbd> that's why you need set
[12:20] <nbd> :P
[12:20] <Yanira> nbd: yeah. but what is if the config file is already there?
[12:21] <Yanira> (and has anonymous sections in it?)
[12:21] <nbd> ?
[12:22] <Yanira> nbd: http://openwrt.pastebin.com/d228aa3aa -- save this to /etc/config/test
[12:23] <Yanira> and now tell me how to change the value option
[12:23] <nbd> uci set test.@test[0].value=something
[12:23] <nbd> or uci set test.@test[-1
[12:23] <nbd> ...
[12:24] <nbd> index 0 means first section
[12:24] <nbd> index -1 means last section
[12:24] <nbd> of a given type
[12:24] <nbd> you can also use @[-1] for the last section regardless of the type
[12:24] <genji1981> wwo! never thought id be ircing from my openwrt box.
[12:24] <genji1981> wwo!=wow.
[12:24] <nbd> heh
[12:25] <genji1981> okay, im stuck. kamikaze. how do i implement a ip packet forwarding nat gateway?
[12:25] <kolter> is there a way to make a 'OR' with the 'DEPENDS' field in openwrt packaging ?
[12:25] <Yanira> nbd: ah, that makes sense. and how to change a section between first and last?
[12:26] <nbd> well, you can use @test[1], @test[2], ...
[12:26] <nbd> for further sections
[12:26] <nbd> or @test[-2] (the one before the last one)
[12:27] <Yanira> cool :)
[12:27] <Yanira> nbd: this shoul be written down somewhre :)
[12:27] <Yanira> maybe just as c&p from here

Default /etc/config/wireless for Atheros WiFi:

# uci show wireless
wireless.wifi0=wifi-device
wireless.wifi0.type=atheros
wireless.wifi0.channel=auto
wireless.wifi0.disabled=1
wireless.cfg0372e0=wifi-iface
wireless.cfg0372e0.device=wifi0
wireless.cfg0372e0.network=lan
wireless.cfg0372e0.mode=ap
wireless.cfg0372e0.ssid=OpenWrt
wireless.cfg0372e0.encryption=none

cfg0372e0 this number always changes if the config section does not have a name.

Example:

# uci set wireless.@wifi-device[0].disabled=0
# uci set wireless.@wifi-iface[0].encryption=psk2
# uci set wireless.@wifi-iface[0].key=topsecret
# uci show wireless
wireless.wifi0=wifi-device
wireless.wifi0.type=atheros
wireless.wifi0.channel=auto
wireless.wifi0.disabled=0
wireless.cfg039472=wifi-iface
wireless.cfg039472.device=wifi0
wireless.cfg039472.network=lan
wireless.cfg039472.mode=ap
wireless.cfg039472.ssid=OpenWrt
wireless.cfg039472.encryption=psk2
wireless.cfg039472.key=topsecret

Revert the changes (only possible if not commited):

# uci revert wireless

(Last edited by Yanira on 31 Aug 2008, 11:46)