There's probably no single answer to this question that fits all targets, so let me outline a device-specific situation and explain further what I mean by "configuration"...
Let's say we have a Linksys EA3500, which is a kirkwood device with dual firmware layout. The device is running very well with the following changes from the "factory" configuration:
- Set root password
- Added packages (in case it's important which packages those are, let's say they are luci-theme-openwrt-2020 and luci-app-advanced-reboot)
- Changed system settings (hostname, time zone, NTP servers)
- Changed network settings (IP address, DNS servers)
- Changed wireless settings (basically, the entire wireless configuration defined from scratch)
- Changed DHCP settings (set new values for dhcp.lan.start and dhcp.lan.limit)
Now, is it possible to somehow change the backup partition so that in the event of a reset, the device would restore to this "last known good" configuration rather than to the "factory" configuration?
Right now, I'm thinking that I could:
- Write a shell script that makes all the changes mentioned above (actually, I already wrote it; it includes password piped to
passwd, a couple of
opkgcommands, a ton of
uci setcommands, and a nice fat
uci commitat the end).
- Boot into the alternative partition using luci-app-advanced-reboot.
- Once the device is up, log in over SSH on a wired connection, upload the script mentioned in point 1, run it, and reboot.
- Once I verify that the changes have taken place, boot back to the original working partition using luci-app-advanced-reboot if necessary. Or perhaps just stay on his "new" partition as working, keeping the other partition as a backup...
Is there any reason I shouldn't try this? Are there any obvious pitfalls I am overlooking? Is there a better way of achieving the desired outcome? (Say, is there a way to write a copy of the entire working partition over the backup partition?) All ideas are welcome, tales of experience, doubly so...