btrbk icon indicating copy to clipboard operation
btrbk copied to clipboard

automated pre- and post- upgrade snapshots?

Open MountainX opened this issue 4 years ago • 6 comments

Thank you for creating and maintaining btrbk. Do you know if any pacman hooks exist for btrbk that could replace snap-pac (for those of us switching from snapper to btrbk)? If they don't exist, I volunteer to help someone create & test them.

snap-pac makes pacman automatically use snapper to create Snapper - ArchWiki like openSUSE's YaST. It uses Pacman#Hooks.

I assume somebody has already created such hooks for btrbk. If they don't exist, does anyone want to collaborate?

MountainX avatar Dec 11 '20 20:12 MountainX

I'm not aware of pacman hooks, I suspect it should be as easy as running something like:

btrbk -c /usr/share/btrbk/contrib/pacman.conf <filter>

Events can be modeled using groups, e.g. specify "group pacman-post-install" and run btrbk pacman-post-install

digint avatar Dec 11 '20 21:12 digint

Thank you for those suggestions.

MountainX avatar Dec 12 '20 19:12 MountainX

@MountainX , did you get anywhere with this? I've just deployed Manjaro on btrfs and I'm looking to install btrbk (after a 5 year hiatus). I'd like to use btrbk exclusively, including for Pacman hooks. Curious if you've made progress on this, thanks!

fmoledina avatar Mar 03 '21 04:03 fmoledina

@MountainX , did you get anywhere with this? I've just deployed Manjaro on btrfs and I'm looking to install btrbk (after a 5 year hiatus). I'd like to use btrbk exclusively, including for Pacman hooks. Curious if you've made progress on this, thanks!

@fmoledina: I've implemented a btrbk pre upgrade hook for myself and it works well with one caveat: btrbk has no concept of retaining "last N snapshots," only hourly, daily, weekly, etc. So if you have multiple upgrade snapshots per time interval (say daily) btrbk will prune all but the first when the next day rolls around.

Here's what I'm working with currently: https://gist.github.com/foundObjects/ec9a5aac9576b489edb6d67fcdb6827f

The aur-helper wrapper script is required to prevent aur helpers (paru or yay) from taking snapshots at each stage of a batched install process, without it they'll often take two or more snapshots per run.

@MountainX The above may interest you as well.

foundObjects avatar Jun 18 '21 02:06 foundObjects

@foundObjects, that looks pretty good! I'll check it out sometime. Thanks!

fmoledina avatar Jun 18 '21 02:06 fmoledina

@MountainX , did you get anywhere with this? I've just deployed Manjaro on btrfs and I'm looking to install btrbk (after a 5 year hiatus). I'd like to use btrbk exclusively, including for Pacman hooks. Curious if you've made progress on this, thanks!

@fmoledina: I've implemented a btrbk pre upgrade hook for myself and it works well with one caveat: btrbk has no concept of retaining "last N snapshots," only hourly, daily, weekly, etc. So if you have multiple upgrade snapshots per time interval (say daily) btrbk will prune all but the first when the next day rolls around.

Here's what I'm working with currently: https://gist.github.com/foundObjects/ec9a5aac9576b489edb6d67fcdb6827f

The aur-helper wrapper script is required to prevent aur helpers (paru or yay) from taking snapshots at each stage of a batched install process, without it they'll often take two or more snapshots per run.

@MountainX The above may interest you as well.

Yes, this interests me. It looks more sophisticated than what I implemented, although I packaged mine up into an Arch Linux (AUR) package with a PKGBUILD. I put it here a couple weeks ago:

Working on pacman hook for btrbk. How to skip action on removing pkg? / Creating & Modifying Packages / Arch Linux Forums

My solution has been working for me, but I will review yours because you have added more functionality.

MountainX avatar Sep 22 '21 02:09 MountainX