Can I use pacman hook to execute a command after a AUR package is updated?

I want to execute a command after a AUR package updated, so I wonder if a pacman hook will be triggered after the specified AUR package is updated by yay -Syu?

Since a helper script generates a custom package and install it using libalpm you should be able to capture the action using a hook.

Place your hook in /etc/pacman.d/hooks

Read the manual on alpm hooks

1 Like

So aur update is able to trigger pacman hook, right?

Since yay is pretty much only pacman in the background so yes. Example of a pacman hook which works post the install/upgrade of mycli, a AUR package:

cat /etc/pacman.d/hooks/mycli-post.hook
[Trigger]
Type = Package
Operation = Install
Operation = Upgrade
Target = mycli

[Action]
Description = example
When = PostTransaction
Exec = /usr/bin/echo "mycli installed successfully"
2 Likes

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