Skip to content

Use pacman hooks to apply changes #61

@WhyNotHugo

Description

@WhyNotHugo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions