Andrew Fyfe wrote:
Bozhidar Batsov wrote:
Andrew Fyfe wrote:
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@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...
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
_______________________________________________ pacman-dev mailing list pacman-dev@archlinux.org http://archlinux.org/mailman/listinfo/pacman-dev
One more question if I may. Old version and new version have meaning only in upgrade context. What should be the value of old version in install context and the value of new version in remove context?
_______________________________________________ pacman-dev mailing list pacman-dev@archlinux.org http://archlinux.org/mailman/listinfo/pacman-dev
For install/remove it's 'source <path to file>/.INSTALL <function name> <version>'
Andrew
_______________________________________________ pacman-dev mailing list pacman-dev@archlinux.org http://archlinux.org/mailman/listinfo/pacman-dev
Yes. I finally understood it completely. Thanks again.