You are not logged in.
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 versionThe 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
Offline
See the function _alpm_runscriptlet in lib/libalpm/trans.c , line 567.
It uses popen (line 657) to run the script, so the full command line is required here, passing all needed arguments.
See man popen .
And then the script itself handles the argument and calls the appropriate function, with these 3 lines.
Edit : I think these kind of questions (specific / technical) are more appropriate on the pacman-dev mailing list.
There are more chances it's seen by a pacman developer, or someone else interested in pacman like me,
and if I said something wrong, they could correct me
Last edited by shining (2007-06-15 15:00:47)
pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))
Offline