[pacman-dev] How does pacman interact with a package's INSTALL script
Andrew Fyfe
andrew at neptune-one.net
Sat Jun 16 09:18:11 EDT 2007
lordbad wrote:
> 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() {
> /bin/true
> }
>
> post_upgrade() {
> /bin/true
> }
>
> pre_remove() {
> /bin/true
> }
>
> op=$1
> shift
>
> $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,
> Bozhidar
>
>
> _____________________
> http://www.e-card.bg/
>
>
> _______________________________________________
> pacman-dev mailing list
> pacman-dev at archlinux.org
> http://archlinux.org/mailman/listinfo/pacman-dev
The function your looking for is _alpm_runscriptlet()
(lib/libalpm/trans.c:567)
http://projects.archlinux.org/git/?p=pacman.git;a=blob;f=lib/libalpm/trans.c;hb=HEAD#l567
Pacman runs 'source <path to file>/.INSTALL <function name> <old ver>
<new ver>', the last 3 lines of .INSTALL are needed to get the function
name and call it.
Andrew
More information about the pacman-dev
mailing list