Sounds reasonable, user8446 also suggested it here. However, I just did a test "restoring" from a tar.gz that contained a single file /etc/test_BAD, and after the subsequent reboot the file was not present in the Shield's folder structure as I'd expected. So the restore script may be doing something more than a simple tar -zxvf.
Signing off for the night, but let you know if I get round to investigating further - insights from anyone else appreciated!
There's a action_flashops() function within /usr/lib/lua/luci/controller/admin/system.lua that looks to do the work from the htm file. Within that it sets a command
local restore_cmd = "tar -xzC/ >/dev/null 2>&1"
but I can't see that this is executed at all. The handler further down in the file looks like it just reboots only:
elseif luci.http.formvalue("restore") then
-- Unpack received .tar.gz
local upload = luci.http.formvalue("archive")
if upload and #upload > 0 then
No calls to /sbin/sysupgrade that I can see. Any tips on syntax for a command to insert before the reboot, to try calling "restore_cmd" against "upload"?
(been 15 years since I've done much unix flavoured scripting!)
Seems a little easier said than done unfortunately. My first attempt was to replace the whole file, but there are a number of dependencies - like the "post" function that the official current system.lua uses - that are missing. Ideally, we'd need to find out the exact version that ITUS forked, then do our comparisons and restores from that. Nice if we could get their repository & full change history somehow (anyone formerly ITUS listening? ;-)
Of course then that version also wouldn't have any of the bug fixes that LuCI people have been working on over the last X months, but that's a separate issue.
Maybe we can keep an eye on the Rhino Labs product to see if the hardware & firmware releases are compatible?
For myself, keeping expectations low.. trying to be satisfied with cherry-picking things for now.
I was finally able to test this out on a 2nd shield box I bought from another user. This saved me 2 hours of custom tweaks and mods... put in all the files in the backup config from my main box, change the file with your fix in the new box and after rebooting just restore with the backup file. Everything copies over and then reboots.
I would recommend everyone do a backup so if you ever need to default you can restore back to your custom config quickly!