I think the idea of reverse engineering makes a lot of sense because it's a really elegant way to automatically upgrade the firmware, whereas using curl to emulate a browser is not elegan.
But considering reducing the difficulty of the project and maintenance costs (when Asus changes the upgrade process, it will need to be reverse-engineered again and push the new code to all routers in a timely manner), the method of curl simulating the browser will be simpler, because it will support all routers, no firmware will be flashed when the code does not work, and as long as there is a firmware upgrade button, all you need to do is tell the script to click that button, and Asus's closed source code takes care of the rest.
Another potential thing to add to your to-do list is that you have to assume that the firmware downloaded from SourceForge or uploaded by RMerlin is not 100% working.
In fact, there have been two cases recently. The first is that
SourceForge failed not long ago and the CDN was unable to distribute files, so SourceForge is not 100% reliable.
and RMerlin once provided firmware in
alpha testing that could cause the router to malfunction, so we must assume that even the final release is not 100% safe.
So how to ensure that the router can be restored to the previous firmware in this case?
A suggested idea is: prerequisite the router must have a USB drive connected, and then save the configuration files, jffs backup and current and newer versions of firmware in the USB drive before each update, because this is the only persistent storage location that has enough storage space and will work when router jffs doesn't work. (Yes, we have to assume that in some cases the jffs partition does not work after upgrading, because in history, they have adjusted the jffs partition by upgrading the firmware, and this kind of thing may cause jffs to not be mounted or need to be initialized).
When the firmware upgrade is completed, a simple check is required, including wifi and internet checks. If the check does not pass, we must assume that there is a problem with the firmware. we must be able to downgrade to the previous firmware (even without internet connection, in which case we will use the older firmware stored in the USB drive).
P.S. new routers no longer have JFFS2 as they use
UBIFS.
Anyway, we do need to assume how to run the script in case jffs is not working, and revert to the old firmware or fix it. (Possibly, this will be the $1 million question. Hahaha)
EDIT:
I do have some thoughts on the $1 million question: the old way,
reverse engineer the Download Master.