User:Allan/Pacman Hooks - Version 1

From ArchWiki
< User:Allan
Revision as of 16:40, 23 January 2009 by Allan (talk | contribs) (Example Config File)
Jump to: navigation, search

The Idea

Short Version: Pacman should have hooks to perform common tasks.

Long Version: Many packages have install files that perform a common task; e.g. adding/removing info files the info directory file, installing/uninstalling gconf schemas, updating the font/desktop/icon cache. It would be good if pacman was extendible through a hooks mechanism so that these could be handled automatically.


A hook would need

  • Information on when the hooks should be run (see "Types of Hooks" below)
  • A list of files or globs that trigger the running of the hook
  • The actual hook script

Types of Hook

Hooks need to be able to cover a variety of tasks. The following types of hooks are a minimum necessary:

  • Hooks run once per transaction (e.g. updating font cache). These would be run whenever a transaction touches a trigger file (both install and uninstall).
  • Hooks that run for every matching file (e.g. updating the info directory). Separate versions would be needed for install and removal of the files.

Proposed Directory Layout


Example Config File

This is presented for comments. Many improvements are likely...

Files = /usr/share/info/*
Run = FileInstall

Files = /usr/share/info/*
Run = PreFileRemove

Files = /usr/share/fonts/TTF/*
Run = Transaction

Hook Script Notes

Hooks that are run once do not need to know what file triggered them but hooks that are run once per file will need to be passed the file name.