Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pacman hooks to apply changes #61

Open
WhyNotHugo opened this issue Jul 27, 2022 · 0 comments
Open

Use pacman hooks to apply changes #61

WhyNotHugo opened this issue Jul 27, 2022 · 0 comments

Comments

@WhyNotHugo
Copy link
Contributor

WhyNotHugo commented Jul 27, 2022

Currently, holoscripts get run by basically including this .install script in each package:

#!/bin/sh

post_install() {
  holo apply
}

post_upgrade() {
  holo apply
}

post_remove() {
  holo apply
}

.install scripts are discouraged whenever possible and treated somewhat of a last resort. In this case, it is possible to use a pacman hook (e.g.: in /usr/share/libalpm/hooks) that runs holo apply when a new files are placed into /usr/share/holo/files/ (or updated, or removed). The hook can be provided by the holo package itself, and also allows non-holo packages to just slip in holoscripts and alike.

This would also ensure that holo apply one gets run once per transaction after packages are installed, rather than once per package.

The hook would be quite trivial, and is a bit more of a declarative (rather than imperative) approach. A vague (poorly tested) sample is something like:

[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Operation = Remove
Target = /usr/share/holo/files/*

[Action]
Description = Applying holoscripts
When = PostTransaction
Exec = /usr/bin/holo apply

I will try and make a PR with this, but would like to hear any thoughts or feedback you may have before further digging into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant