FS#710 - more post/pre install/remove actions possible?
Attached to Project:
Pacman
Opened by Jan de Groot (JGC) - Thursday, 08 April 2004, 07:59 GMT
Last edited by Judd Vinet (judd) - Thursday, 08 April 2004, 18:05 GMT
Opened by Jan de Groot (JGC) - Thursday, 08 April 2004, 07:59 GMT
Last edited by Judd Vinet (judd) - Thursday, 08 April 2004, 18:05 GMT
|
Details
Is it possible to have post_remove, pre_install and more of
those actions in .install files?
Sometimes we have to make stupid workarounds in pre_remove scripts because we need a post_remove. I don't think it's hard to implement these extra actions, and making them optional won't break existing packages that don't have these actions. |
This task depends upon
Can you point me at some packages that have these ugly workarounds? I need inspiration. :)
Take a look at librsvg as an example:
When installing the library, we simply query the gtk-immodules and GTK knows how to handle SVG files...
Now the remove feature: there isn't any. With a post_remove function, we could simply query the gtk-immodules again, which causes gtk to remove support for SVG, since the lib is gone then.
Another nice thing we could implement with a pre_install or post_remove: some kind of alternatives system. For example, one of my friends tried to build Heimdal kerberos for Archlinux. Nice and shiny, the package replaces things like login with kerberized versions. pacman won't install them, because you have to force it.
Force the package, then remove it, and you're left with a not-working archlinux installation because login is missing. Debian uses a far too advanced alternatives system to manage the default C compiler, the default X window manager, the default java binary, etc.
But pre_install is trickier, since the install scriptlet is extracted from the package itself at the same time as the rest of the files.
We may have to compromise for now and just have a post_remove scriptlet. pre_install can come later as more "inspiration" hits. ;)
The only thing why we would need a pre_install script is because of some kind of alternatives system that debian uses too: let's get the kerberos example from above:
- rename existing files in pre_install script
- unpack and install the new package
- rename files back when deinstalling package on post_remove
1) pre_install() and post_remove() simultaneous - Install (making backup) and uninstall (restore) programs which need's overwrite files stored by another program for example:
- ati.2 driver (need's overwrite xfree86 files)
- nvidia driver (with extract original driver and arch-style install, need's overwrite xfree86 files too)
2) post_remove() alone - Clean uninstall some program's, for example mozilla-firefox stored after first run some files in default location (/opt/mozilla-firefox) which not uninstall after pacman -R mozilla-firefox