Working on pacman hook for Arch Linux
- Dominant language
- Perl
- Stars
- 2.1k
- Forks
- 139
- PR merge metrics
- No merged PRs in 30d
Description
I am working on pacman hooks that use btrbk to create pacman pre/post btrfs snapshots on Arch Linux. I did not find any existing btrbk package for pacman hooks, so I am working on it myself.
Assume this package will be named btrbk-pac. (Although btrbk-pacman-hook is another option. Suggestions?)
The pre-hook and post hook will look like the following:
# cat /usr/share/libalpm/hooks/05-btrbk-pac-pre.hook
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = *
[Action]
Description = Performing btrbk pre-pacman snapshots for the following configurations...
Depends = btrbk-pac
When = PreTransaction
Exec = /usr/bin/btrbk run root --preserve --override=snapshot_create=always
NeedsTargets
AbortOnFail
# cat /usr/share/libalpm/hooks/zz-btrbk-pac-post.hook
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = *
[Action]
Description = Performing btrbk post-pacman snapshots for the following configurations...
Depends = btrbk-pac
When = PostTransaction
Exec = Exec = /usr/bin/btrbk run root --preserve --override=snapshot_create=always
NeedsTargets
How does that look?
The btrbk command in the hooks filters on "root". It depends upon the btrbk.conf file having a "root" item defined. That config item that matches the filter can be a group-name, volume-directory, etc. as per the [btrbk man page](https://digint.ch/btrbk/doc/btrbk.1.html#_filter_statements). (I would recommend configuring a "root" group in the btrbk.conf file for this hook.)
I asked a related question on the pre-hook on the Arch Forum here:
[Working on pacman hook for btrbk. How to skip action on removing pkg? / Creating & Modifying Packages / Arch Linux Forums](https://bbs.archlinux.org/viewtopic.php?pid=1991736#p1991736)
I appreciate any suggestions or feedback.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.