On Wed, May 02, 2007 at 02:28:41PM -0400, John Rouillard wrote: > So the only way to really make sure that packages won't be lost from > the database is to check the install mode in a pre-scriptlet. With > rpm, you can search for the parent process of the pre scriptlet and > look for -i or --install on the command line. In yum there is no such > method. > > So if somebody screws up the yum conf file and you accidently get an > upgrade rather then a true install... well it's bad. > > My idea was to set an environment variable YUM_MODE='install' or > 'upgrade' as each package is installed that is available to the > scriptlets so it could easily check to see what mode it was being > installed. However I haven't had any luck doing that either with the > core code or via a plugin in the pretrans_hook. > > I think the pretrans hook should work as I think it is called for > every package that is up be upgraded (c.f. rpm's pretrans scriptlet), > but it's not explicit from the documentaion > http://wiki.linux.duke.edu/WritingYumPlugins what the scope of the rpm > transaction is, I assume package by package. Hi all: Just for the record, with yum-2.4.3-1 in centos 4, the pretrans_hook is called only before all packages are installed. It is not called for each package in the sack that is to be installed. So this route isn't fruitful. Indeed it is starting to look to me that there is no way to do this as I think the function/callback that does the install is in rpmmodule.so. The function is passed the entire sack of rpm's to install and only in that shared object is the sack broken up into seperate rpms, and the rpm pre scripts are called. Which would also explain why I can't seem to find the location in the pythin code where the scriptlet is run. This would make me feel better. I am a novice with python, but I think I know enough that I should be able to find the invocation of a shell script in the code. Can anybody confirm that the sack is unpacked and installed by functions in the shared object? If so I guess I can give up on using yum to install the packages and need to figure out some other mechanism. Maybe I can still use yum to download the rpms, that will save some work at least. AtDhVaAnNkCsE -- -- rouilj John Rouillard System Administrator Renesys Corporation 603-643-9300 x 111 _______________________________________________ Yum mailing list Yum@xxxxxxxxxxxxxxxxxxxx https://lists.dulug.duke.edu/mailman/listinfo/yum