Open probonopd opened 8 years ago
There are files like ./builder/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
which seem to have the required information, I am just not sure how to make use of them for the https://github.com/krebscode/minikrebs/blob/master/traits/network/client-mode/files/etc/config/network file.
Sorry for the delay, network/client-mode uses an old way to handle configuration (directly writes to /etc/config/network
).
New traits use the firstrun.d facility to write uci configuration.
For a sample see https://github.com/krebscode/minikrebs/blob/master/traits/network/wifi-client/files/etc/firstrun.d/10_wifi_client in /etc/firstrun.d you write files which will be evaluated 'once' (or throw an error). In these scripts you can call uci to configure and store the changes.
Regards
How is that different from using target/linux/ar71xx/base-files/etc/uci-defaults/
or files/etc/uci-defaults/
which seems to be the official OpenWrt way of doing things?
See http://wiki.openwrt.org/doc/uci#defaults:
To set some system defaults the first time the device boots, create a script in the folder /etc/uci-defaults/.
All scripts in that folder are automatically executed by /etc/init.d/boot and if they exited with code 0 deleted afterwards (scripts that did not exit with code 0 are not deleted and will be re-executed during the next boot until they also successfully exit).
In a live router you can see the existing uci-defaults scripts in /rom/etc/uci-defaults , as /etc/uci-defaults itself is typically empty (after all scripts have been run ok and have been deleted).
Probably the OpenWrt way is to drop a file into etc/uci-defaults
which does additional configuration after the OpenWrt-provided scripts there have run.
Please see what I have written at https://github.com/probonopd/minikrebs/issues/1#issuecomment-167539921 - not tested yet, though (I don't have a serial console available right now for testing in case it goes bad...)
oh oh, it seems i have rebuilt something which existed before in openwrt anyway :\
But the idea is the same, write a script dump it in etc/uci-default
and it will evaluate on first boot.
Thanks for the heads-up.
I don't see how this commit closes this issue...
somehow while merging your code github decided to close this issue ...
I have a couple of devices, and the name of the main Ethernet port is different on each one:
eth0
,eth0.1
,eth1
.Bad things happen if the image contains the wrong name in
/etc/configuration/network
. For example, the A5-V11 router useseth0.1
rather thaneth0
oreth1
, so be aware of that in order for the wired Ethernet to work. You need to change/etc/configuration/network
accordingly or the device will not be accessible after flashing without using a serial adapter to unbrick (or possibly OpenWrt Failsafe).I see there has been work in this area https://github.com/krebscode/minikrebs/commit/51a66f78c48f7cca9ea7d187f5410a026d8b27af
Is it possible to configure https://github.com/krebscode/minikrebs/blob/master/traits/network/client-mode/files/etc/config/network in a way that it does not hardcode
eth0
?