Hi Luka!

On Thu, Oct 27, 2011 at 10:33:25AM +0200, Luka Perkov wrote:
> On Thu, Oct 27, 2011 at 02:49:00AM +0200, Daniel Golle wrote:
> > /etc/fw_env.config in case it doesn't exist yet and we got settings in uci.
> 
> Is the init script the right approach? I like the uci idea, but running
> init script at every boot to write the same settings each time seams
> like a waste of resources to me.
This script creates the config-file writes the values only if the file doesn't
exist yet values exist in UCI.
Once this is done, it would usually just check a single [ -e /etc/fw_env.config 
]
and then exit, as the file exists.
If there is no /etc/config/ubootenv at all (that's the other 99% of boots case)
config_load wouldn't do much as it can't find the config and config_foreach
would just do nothing.
/etc/init.d/defconfig works in a very similar fashion and checks against *all*
files in /etc/$board/defconfig.
I don't see how we could do that in any much more efficient way which doesn't
make it more ugly. One option would be to create the file out of
/etc/uci-defaults/*, which would be slightly more efficient but as the name says
uci-defaults I'd consider that (directly writing a config file) as an abusive
way of utilizing /etc/uci-defaults/.

> Maybe to rewrite it and call it fw_getconf? In that case you should add
> it as option in 'make menuconfig'.
> 
> > For the sake of PFY protection don't install the fw_setenv symlink.
> 
> I think this is wrong, symlink should be created. If you want this
> create a package that wont have this, for example
> uboot-envtools-readonly.
Agreed, this should be a menuconfig option like "create fw_setenv symlink".
I'll update the patch accordingly and post it in a few moments.

Cheers

Daniel
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to