Initial network configuration via firmware selector

There is a very useful server already, It allows one to customize the downloaded image by supplying the list of installed packages and the first-boot script (uci-defaults).

The feature request is to improve the user experience by providing ready-made uci-defaults templates for basic tasks such as configuring the static IP on the WAN, or setting up PPPoE credentials, or setting up WiFi SSID and password, or enabling/disabling IPv6. Just a link to a wiki page with examples that can be copy-pasted is enough to consider this feature request done, but of course a GUI will be better.


You have it more or less ready. The firmware selector has a textarea to add a script to execute the first boot. If you include here the uci commands to do this config, will work (I suppose, I've not tried it).

The only thing missing is a link to the web page with samples.

I made a feature request ticket:

1 Like


I noticed that you authored the post I linked; and I read your "feature request ticket". In its entirety, it reads:

It would be nice to be able to select the uci-defaults from a small collection of templates. If we can find a meaningfull collection that is.

  1. empty template / clear field
  2. enable/configure WLAN
  3. ?

Aside from No. 1 - which I assume means "Default Configuration - it's rather unclear what you're asking for. Are you asking the developers to make a "meaningful collection of templates" for you?

(I linked your post because it was a sample/template.)

Hi @lleachii, I try to sketch out how this feature would look like and work.

Right now I have to designs in my mind:

  • multiple icons, each will fill in a special template (one for setting up wlan, one more for IP address settings, ...)
  • or just one icon that fills in a script with a bunch of popular variables on top

I think this really depends on the kind of things people need/want. That is why I had this open list in the ticket.
The actual implementation of templates is not that hard, but anyone who wants to contribute templates is welcome. :slight_smile:

1 Like

As I said, I want this to be modular. Buttons should append their pieces of the script to the bottom. E.g., I could start with an empty uci-script field, then select PPPoE and the area should get populated with a script that configures PPPoE, with some placeholders. I could then click the WiFi button, and it appends the script that configures WiFi, again with placeholders, e.g. with SSID, password, and channel, that I need to replace with actual SSID, password, and channel. At the end, the uci-config area would be the concatenation of these two scripts. When I set the correct values in both parts of the script instead of the placeholders, I am then done with a router that will then have PPPoE and WiFi.

Regarding the script fragments, I think they should be ultra-simple, linear, short, reliable, and to the point. No need to generalize. Any "if" or loop is a bug. Example for PPPoE:

# Configure pppoe connection
uci set network.wan.proto=pppoe
uci set network.wan.username='<pppoe_username>'
uci set network.wan.password='<pppoe_password>'
# See more variables here:
uci commit network

Example for WiFi:

# Set the wireless channels for both radios
uci set'1'
uci set'36'
# More options:

# Configure WiFi interface 0
uci set wireless.@wifi-iface[0].device='radio0'
uci set wireless.@wifi-iface[0].ssid='My AP'
uci set wireless.@wifi-iface[0].encryption='psk2'
uci set wireless.@wifi-iface[0].key='xxxxxxxxxx'
# More options:

# Configure WiFi interface 1
uci set wireless.@wifi-iface[1].device='radio1'
uci set wireless.@wifi-iface[1].ssid='My AP 5 GHz'
uci set wireless.@wifi-iface[1].encryption='psk2'
uci set wireless.@wifi-iface[1].key='xxxxxxxxxx'
# More options:
uci commit wireless

I do not think there is a need to set the channel and the device. Also not every router has two wireless devices.

A simple

uci set wireless.@wifi-iface[0].ssid='My AP'
uci set wireless.@wifi-iface[0].encryption='psk2'
uci set wireless.@wifi-iface[0].key='xxxxxxxxxx'
uci commit wireless

seems to be sufficient.

EDIT: But we need to enable the wifi-device as well.