Tux's lil' helper
Joined: 24 May 2003
Location: Rome, Italy
|Posted: Tue Feb 10, 2004 8:45 pm Post subject: How to find out if the user is unmerging or updating a pkg?
I'm writing an ebuild for Jakarta Tomcat 5(.0.1. Although I based myself on the existing ebuild for the 4.1.24, I don't like it very much and I would like to improve it.
My question does not relate strictly to Tomcat, though, as it can relate to any other package which benefits from having a custom user (e.g.: httpd, ftp, ...).
From what I have understood, when I unmerge a package, the pkg_postrm() of its ebuild is executed. In the ebuild for Tomcat 4.1.24 this is the place where tomcat user and group are deleted, as example.
When I update a package, it seems to me that the pck_postrm() of the previous version is issued after the src_install() of the new one. This is what happens when I update Tomcat from 4.1.24 to 5.0.18: tomcat user and group are not created during the pkg_setup() of the new (5.0.1 because they already exist, but then they are deleted at the end of pkg_postrm() of the old (4.1.24)!
This leaves me with an incorrect installation, since tomcat user and group no longer exist. I have to manually create them.
I wanted to know: is there a way for me (as in "ebuild writer") to know if pkg_postrm() has been called during an unmerge (so I remove everything) or during an update (so I don't touch what would be needed at the end of the install)?