[pacman-dev] Hooks for pacman

Allan McRae allan at archlinux.org
Thu Jan 22 10:15:03 EST 2009

Hi all,

A new feature I am ever so slightly obsessed about at the moment is the 
possibility of having hooks in pacman for doing common tasks in install 
files.  e.g.  adding info pages to directory, updating 
font/icon/.desktop cache, gconf stuff... 

So, how would this be implemented?   Here is my outline:

Two types of hooks would be needed for both install and remove.  One 
type that is run for every matching file (e.g. info install) and one 
type that is run once per transaction (e.g. font cache update).  These 
could be stored in /etc/pacman.d/hooks/ with an index of hooks in 
/etc/pacman.d/hooks.conf.  The .conf file could look something like:

PerFile = infopage    /usr/share/info/
PerTrans = fontcache    /usr/share/fonts/


That needs improvement, but that covers the information that needs 
presented - whether the hook is run per file or per transaction, the 
name of the hook and the directory whose files set off this hook.  Maybe 
the conditions that set the hook off should be in the actual hook file.

I guess the actual hook would look look just like:

do stuff here...

I figure we must already generate a list of all the files being 
added/removed during conflict checks, so we would "just" need to scan 
that list for what hooks need to be run and actually run them.

Anyway, I thought I would post this idea here so I could get more 
feedback on the implementation and maybe convince someone to code it...


More information about the pacman-dev mailing list