diff --git a/README.md b/README.md index 5fb55979..d2b70437 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,7 @@ You can selectively include items for backup from the ***Settings*** window. Sel - **@** and **@home** subvolumes may be on same or different BTRFS volumes - **@** may be on BTRFS volume and **/home** may be mounted on non-BTRFS partition - If swap files are used they should not be located in **@** or **@home** and could instead be stored in their own subvolume, eg **@swap** + - Separate partitions (e.g. `/boot`) can be handled via custom created hooks (placed in `/etc/timeshift/backup-hooks.d/` and `/etc/timeshift/restore-hooks.d/`). Script naming must match `run-parts` [requirements](https://manpages.ubuntu.com/manpages/noble/man8/run-parts.8.html). Current snapshot path is exported as `TS_SNAPSHOT_PATH`. - Other layouts are not supported - Make sure, that you have selected subvolume *@* or */@* for root. You can check that executing script below, and if output is *OK*, then everything is alright. diff --git a/debian/control b/debian/control index 89e773fc..0215d47b 100644 --- a/debian/control +++ b/debian/control @@ -18,7 +18,7 @@ Homepage: https://github.com/linuxmint/timeshift Package: timeshift Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, rsync, btrfs-progs | btrfs-tools +Depends: ${shlibs:Depends}, ${misc:Depends}, rsync, debianutils, btrfs-progs | btrfs-tools Replaces: timeshift-btrfs Description: System restore utility Timeshift is a system restore utility which takes snapshots diff --git a/src/Core/Main.vala b/src/Core/Main.vala index a47a3aed..f25d5a2c 100644 --- a/src/Core/Main.vala +++ b/src/Core/Main.vala @@ -352,7 +352,7 @@ public class Main : GLib.Object{ log_debug("Main: check_dependencies()"); - string[] dependencies = { "rsync","/sbin/blkid","df","mount","umount","fuser","crontab","cp","rm","touch","ln","sync","which"}; //"shutdown","chroot", + string[] dependencies = { "rsync","/sbin/blkid","df","mount","umount","fuser","crontab","cp","rm","touch","ln","sync","which", "run-parts"}; //"shutdown","chroot", string path; foreach(string cmd_tool in dependencies){ @@ -1693,6 +1693,16 @@ public class Main : GLib.Object{ set_tags(snapshot); // set_tags() will update the control file + // Perform any post-backup actions + log_debug("Running post-backup tasks..."); + + string sh = "test -d \"/etc/timeshift/backup-hooks.d\" &&" + + " export TS_SNAPSHOT_PATH=\"" + snapshot_path + "\" &&" + + " run-parts --verbose /etc/timeshift/backup-hooks.d"; + exec_script_sync(sh, null, null, false, false, false, true); + + log_debug("Finished running post-backup tasks..."); + return snapshot; } @@ -3032,6 +3042,17 @@ public class Main : GLib.Object{ log_msg(_("Restore completed")); thr_success = true; + + // Perform any post-restore actions + log_debug("Running post-restore tasks..."); + + string sh = "test -d \"/etc/timeshift/restore-hooks.d\" &&" + + " export TS_SNAPSHOT_PATH=\"" + snapshot_to_restore.path + "\" &&" + + " run-parts --verbose /etc/timeshift/restore-hooks.d"; + + exec_script_sync(sh, null, null, false, false, false, true); + + log_debug("Finished running post-restore tasks..."); if (restore_current_system){ log_msg(_("Snapshot will become active after system is rebooted."));