wmutschl / timeshift-autosnap-apt

Timeshift auto-snapshot script for Ubuntu and Debian based systems which creates snapshots of your system with timeshift before a package install, remove or upgrade using DPkg::Pre-Invoke hook in apt. Fork of timeshift-autosnap from AUR.
MIT License
154 stars 20 forks source link

Add timer when snapshot creation fails due to timeshift running #13

Open daPhipz opened 1 year ago

daPhipz commented 1 year ago

This enables the user to close Timeshift and try again in a 30-second time window. I hope you can understand my code, I sometimes write very non-self-explanatory code xD I'll add some comments to explain how it works. I tested it with the apt install, apt remove and apt purge commands - it works as expected.

majal commented 1 year ago

This was a problem for me too, especially that all updates are done in the background. It happened to me that updates failed because I left Timeshift open the whole time.

Since being in the background mean that I cannot interact with it, I just edited the exit code. exit 0 instead of exit 1 😄

{ echo "Unable to run timeshift-autosnap-apt! Please close Timeshift and try again. Script will now exit..." >&2; exit 0; }

I'm not sure of what would be a more elegant solution... (Kill Timeshift?)