Hi everyone
I want to share my work here, in case anyone has any feedback, has done this before, or might look into doing it in the future.
I am using OpenWRT r45574 on TP-Link TL-WR710N hardware, and need to write a custom /etc/rc.button/reset script to allow for the rollback of configuration changes to a previous, safe, state.
I use these small devices as inexpensive networked serial/RS232 probes. A USB-to-serial adapter is plugged into the USB and either the 802.11 wireless radio or the built-in ethernet interface is used to connect to the local network.
I mail these devices out to remote sites in far-away places and usually never see them again.
By default, I leave the network interfaces configured as DHCP clients, but sometimes I need to do crazy stuff like set a static IP, route between interfaces, or VPN/NAT between interfaces.
When I make such changes and then reboot to apply them, there is a chance that I will permanently lose access to the device if mistakes are made.
A solution to mitigate this risk is to make the reset button restore a previously saved configuration state, which will allow the client to be accessed once again.
I imagine that I would write a script, like "saveconfig" or "savesafe", which would then tar up /etc and other critical files to some location on the local flash. Then, when the reset button is pressed for less than 2 seconds, the reset-button script would restore this safe configuration and reboot the device. Theoretically, I could then regain control of the device since the old config was known to be working.
I can't use the default reset behavior, because that totally wipes the overlay flash via a jffs2reset. I would lose required local customization which would break the device.
So, I need a custom solution.
Has anyone done this before, and do you have any feedback?
I will be working on this today and will post a script or whatever I figure out once I do it.