[pacman-dev] How does pacman interact with a package's INSTALL script

lordbad lordbad at e-card.bg
Sat Jun 16 08:58:28 EDT 2007

In the documentation I have read the following:

    There are also install files. This PKGBUILD specifies 'foo.install' as the
package's install file. Here is an example install file:

    post_install() {

    post_upgrade() {

    pre_remove() {


    $op "$@"

    Here are the function explainations :

        * post_install : this script is run right after files are installed, it
takes one argument :
              o the package version
        * post_upgrade : this script is run after all files have been upgraded,
it takes two arguments :
              o the new package version
              o the old package version
        * pre_remove : this script is run right before files are removed (stop a
daemon for example) and takes one argument :
              o the package version

    The three lines at the bottom are needed in every install file so that they
run properly.

But I do not understand how does pacman handle these scripts. Does it source the
scripts first and then call the shell functions defined in them with some C
function like "system" for example? But if it does so why are the last 3 lines
needed - I see little if any need for them. So if anyone can give me some hints
on the subject and maybe even mention which of pacman's source files implements
this functionality I'd be very grateful. Thanks in advance for your help.

Best Regards,


More information about the pacman-dev mailing list