Is there a mechanism that after system upgrade to run a script?

Hi, I have many installed packages that need to reinstall it after system upgrade.
I found that with Opkg extras I could make the package list backup into uci configuration files and after upgrade I can use Opkg to restore it. but by manual not auto
is there a mechanism that after system upgrade will going to run a script file once? like the init.local? I am going to write the Opkg restore command in to that file.
And also when using the web-luci to upgrade system. is it running with the -k option within sysupgrade ?

Thank you!

No, but you could use the imagebuilder to include your desired packages into the firmware image before flashing.


I had the impression that the -k option would install afterwards all the packages listed in /etc/backup/installed_packages.txt.

But this is not a real script. I am not using this, as before I need to remove packages ( replace wpad-basic by wpad...)

You can invoke the commands using /etc/rc.local, and it should start after upgrade if you choose to keep settings, but resolving possible race conditions is up to you.