[OpenWrt-Devel] [PATCH 1/2] base-files: indicate initial setup by uci system config option

Adrian Schmutzler mail at adrianschmutzler.de
Mon Nov 11 06:28:29 EST 2019


Hi Karl,

> Adrian Schmutzler <freifunk at adrianschmutzler.de> wrote: 
> > This provides a uci system config setting that will be set only 
> > during initial setup. This can be used by uci-defaults script 
> > to determine whether they are run during initial setup or after 
> > a sysupgrade. 
> Given that it will be set again after every sysupgrade, I think 
> the name is unclear. (I don't have a better one) 

No, it won't! That's the whole idea behind this thing. At the beginning of config_generate, there is check whether /etc/config/system already exists (simplified for this argument), and in this case the script is terminated. So, the option will _only_ be set after initial install or after "sysupgrade -n ..." (or when someone deletes his/her /etc/config/system manually).

> You've also deleted it at 90-xxxx, so good luck anyone 
using 99 or similar to "be at the end".

Well, I consider it good practice to _not_ use the last number. It will be easy to move a script before 90-xxx, but if for some reason I don't see (there always is one) it is required to run after, it will be easy to do. (One could as well have chosen 95 ...)

> Having it baked in makes 
> it hard to do the difference between _first_ install and 
> upgrades/reinstalls. 

See above. Achieving that is actually the goal.

> We solved this by having a uci-defaults script _set_ a flag. 
> (_not_ baked in) This allows scripts to detect that flag and know 
> whether it's truly a first boot or not. 
> With your setup, as a script author, all you know is that it's 
> the first boot since a sysupgrade, iff you run before 90_end. 

I do not get your point here.

Best

Adrian 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20191111/2a0e9548/attachment.sig>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list