Pamac & Hooks for AUR packages

Is it possible to add hooks for AUR packages when using pamac to install/upgrade them? I’d like to add hooks on upgrade of certain packages - some of them coming from official repositories (so I’ve added pacman hooks) and some of them coming from AUR.

I primarily use pamac cli to do major upgrades and GUI when there are less than 10 packages to upgrade as using it allows me to use a single place to upgrade both from official repos and from AUR.

Questions:

  1. When a package (coming from the official repos i.e. pacman can find it) is upgraded using pamac and has a hook for it listed in /etc/pacman.d/hooks/ does it get triggered?
  2. I’ve enabled pamac to install (and Update) from AUR. Is it possible to add a hook for these packages?

As custom packages - built and installed by pamac - is installed using libalpm you can add hooks for any package - including custom packages.

This question has been asked before - try the search funcion :mag: in upper right corner.

Hi @wpkg,

Have a look here:

https://wiki.archlinux.org/title/Pacman#Hooks

and here:

https://man.archlinux.org/man/alpm-hooks.5

And, as @linux-aarhus said, using the search function delivers, among other thing, this:

2 Likes

you can use -a for AUR packages e.g. sudo pamac update -a --force-refresh --no-confirm

@linux-aarhus & @Mirdarthos Thank you for the hint and links. I did read through the man page alpm-hooks.5 before posting the question.

The interesting part for me was this:

Hooks are read from files located in the system hook directory /usr/share/libalpm/hooks, and additional custom directories specified in pacman.conf(5) (the default is /etc/pacman.d/hooks). The file names are required to have the suffix “.hook”. Hooks are run in alphabetical order of their file name, where the ordering ignores the suffix.

I was under the impression that since hooks are placed in a directory called pacman.d/hooks they were applicable only when pacman is used, rather than thinking about them as alpm-hooks. But now thinking through this and the fact that both pacman and pamac are based on libalpm and /etc/pacman.d/hooks is an alpm hook directory rather than pacman exclusive, it makes sense.

@robin0800 : I think your answer is about forcing an AUR update through pamac and not related to hooks in general. But I may be mistaken.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.