UCI config migration across OpenWrt releases
Tanjeff Moos
Tanjeff.Moos at westermo.com
Wed Apr 22 05:43:58 PDT 2026
Wow, thanks for the thorough insight! That helps a lot!
Regards, Tanjeff
On 4/18/26 16:24, Eric wrote:
> In any case, sysupgrade does:
>
> 1) Create backup and stash it.
> 2) Copy/dd in new image with complete default uci-defaults.
> 3) Reboot.
> 4) Restore backup.
> 5) Each/etc/uci-defaults/* is run. Often it starts off with
> '[ -e /etc/config/whatever ] && continue' or some such thing
> to bail out if there's already a user config.
> 6) If a config change (i.e., migration is needed), do it now.
> 7) If script completes without error, delete it; scripts with
> an error exit are retained and re-run at each reboot.
>
> And installing or upgrading a package:
>
> 1) Installs package contents, updates package manager database etc.
> 2) The package may contain a uci-defaults script, which is installed
> in the usual place (that's how it got there during image build).
> 3) By default, the package also contains a "post-install" script,
> called 'postinst' script defined in include/package-pack.mk.
> 4) The package manager fires off the post install script, which
> then loads '/lib/function.sh' and runs the 'default_postinst'
> function mentioned previously.
> 5) This executes any uci-defaults, just like steps 5-7 above,
> effecting any needed migration, upgrades or whatever.
> script associated with the package).
More information about the openwrt-devel
mailing list