Nano automatic rollback configuration after a failed upgrade
0 reputation · 13 Jun 2021, 07:19 UTC
Goal: Configure nano to automatically restore the most recent backup file when a newly upgraded nano binary fails to start or crashes, eliminating the need for manual file copy.
Current behavior: nano creates a single backup with a tilde (~) suffix on each save, but provides no option to trigger a rollback automatically after a failed upgrade; recovery relies on the user having write permission in the file’s directory and manually copying the backup over the active file.
Uncertainty: It is unclear whether a configuration setting could be added to nano to enable this automatic rollback, or if retaining multiple backups would be required to safeguard against intervening saves that overwrite the single tilde file.
Specific questions:
- Is there a configuration flag or setting that can be added to nano to enable automatic rollback to the backup file after a failed upgrade?
- Can nano be configured to keep more than one backup version to prevent loss of the pre‑upgrade state if additional saves occur?
- Would an external wrapper or hook be the only practical method to achieve this behavior without modifying nano’s source code?