SysUpgrade hooks for opkg install while upgrading

Is there any solution to get a sysupgrade to be more customizable ?
I need to get the overlay (real rootfs) partition to be reformated and so to be resynchronized with the new system image file installed.
Then I need also to opkg install some more ipkg to this overlay root fs.

Is it all possible from sysupgrade or do I need to get some hooks at first bootup to exist ?

You need firstboot hooks for that.

I use an extroot which makes upgrading a bit more annoying, but I just run some scripts which make it fairly simple.

My process:

  1. create backup
  2. remove the extroot device (an SD card in my case)
  3. boot the system, run sysupgrade (without preserving settings)
  4. install packages for extroot
  5. re-insert extroot device
  6. mount extroot device, delete all files
  7. perform extroot process; reboot
  8. install packages
  9. restore backup

I have scripts to handle the package installation (both pre- and post-extroot) as well as perform the media erase and extroot pivot process, so it all takes ~10 mins.