feat(hook): Use separate hook per transaction type (#1)

This commit is contained in:
hygienic-books 2023-03-05 22:15:55 +01:00
parent f7f6d71250
commit 1113a32888
4 changed files with 26 additions and 3 deletions

View File

@ -53,4 +53,5 @@ The following _scopes_ are known for this project. A Conventional Commits commit
- `auto`: Change how `zfs-auto-snapshot` is run - `auto`: Change how `zfs-auto-snapshot` is run
- `conf`: How we deal with script config - `conf`: How we deal with script config
- `script`: Any other script work that doesn't specifically fall into the above scopes - `script`: Any other script work that doesn't specifically fall into the above scopes
- `hook`: Configuring the hook(s)
- `meta`: Affects the project's repo layout, readme content, file names etc. - `meta`: Affects the project's repo layout, readme content, file names etc.

View File

@ -1,14 +1,12 @@
[Trigger] [Trigger]
Operation = Install Operation = Install
Operation = Upgrade
Operation = Remove
Type = Package Type = Package
Target = * Target = *
[Action] [Action]
Description = Create ZFS snapshot on active system dataset Description = Create ZFS snapshot on active system dataset
When = PreTransaction When = PreTransaction
Exec = /bin/sh -c 'while read -r f; do echo "$f"; done | /usr/local/bin/pacman-zfs-snapshot' Exec = /bin/sh -c 'while read -r f; do echo "$f"; done | /usr/local/bin/pacman-zfs-snapshot install'
Depends = zfs-auto-snapshot Depends = zfs-auto-snapshot
AbortOnFail AbortOnFail
NeedsTargets NeedsTargets

View File

@ -0,0 +1,12 @@
[Trigger]
Operation = Remove
Type = Package
Target = *
[Action]
Description = Create ZFS snapshot on active system dataset
When = PreTransaction
Exec = /bin/sh -c 'while read -r f; do echo "$f"; done | /usr/local/bin/pacman-zfs-snapshot remove'
Depends = zfs-auto-snapshot
AbortOnFail
NeedsTargets

View File

@ -0,0 +1,12 @@
[Trigger]
Operation = Upgrade
Type = Package
Target = *
[Action]
Description = Create ZFS snapshot on active system dataset
When = PreTransaction
Exec = /bin/sh -c 'while read -r f; do echo "$f"; done | /usr/local/bin/pacman-zfs-snapshot upgrade'
Depends = zfs-auto-snapshot
AbortOnFail
NeedsTargets