Update MerlinAutoUpdate.sh#13
Conversation
Some minor cleanup and tightening up code.
|
WRT your "check_memory_and_reboot()" function where you check for free RAM vs F/W file size, I think there are a couple of other places along the way when free RAM may not be sufficient:
For such cases, you might need to check available free RAM before the ZIP file is downloaded, and then again before uncompressing/extracting the files, especially if using the router's "$HOME" directory for all of it, and not the USB drive at all. Also, you might need to add some "overhead" to the file size comparison to account for the "ZIP + F/W" files being on the "$HOME" directory at the same time, even if just temporarily. I don't have a router with low physical RAM (< 512MB), so I have no way to test/verify the above scenarios, but I think that's something to consider for future improvements. Just my 2 cents. |
I actually fully agree, to be honest I don't like my implementation, it's too basic because it doesn't re-trigger the update post reboot, it would be ideal if we could schedule a cron for lets say, 5 minutes out, and commit it to memory, and then reboot, so upon reboot it tries again. The complication for me is how to undo the committed 5 minute cron after the update is done? do we even need too or would it be flushed out after the update? I know currently our cron flushes out after a reboot, so it's not committed yet anyways. |
Take a look at the code changes in PR #14. They address both scenarios where a cron job needs to be persistent across reboots, and also the "post-reboot" trigger to rerun the script after some delay to make sure all services are started (such as NTP) so networking services are ready to go. I have not tested it all yet, but so far the add/delete mechanism for persistency works fine on my router. |
Some minor cleanup and tightening up code.