epidose
epidose copied to clipboard
Monitor hard resets and restore device to pristine state
- On boot check if
/var/lib/epidose/restore
exists, and if so, perform a clean installation - On boot create
/var/lib/epidose/restore
to indicate that a full restore is needed - On a graceful shutdown remove
/var/lib/epidose/restore
The procedure for running these commands is described here.
In order to help with restoring the device to a pristine state, one could use a special initramfs that checks the root partition and either loads linux from an image or a different partition, or repairs the root partition using an included rootfs image (for example as a tar.gz file on the boot partition). For example: https://unix.stackexchange.com/questions/460219/how-to-run-a-script-before-switch-root-in-initramfs
A different approach could be a second stage bootloader (for example u-boot) but that could complicate things.