|
From: | Phil D'Amore |
Subject: | Re: method to check for package installation |
Date: | Wed, 28 Apr 2004 09:42:03 -0400 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030314 |
Argh!That's what I get for reading mail before having any coffee! I misunderstood your mail earlier. Sorry 'bout that. There are probably two issues here:
1. Unless it is automatically done somewhere in the parser before the code for the package action is hit, there is no attempt to do variable interpolation on the package name. I'm pretty sure the parser isn't doing this on its own, too. I never even thought of the need to do that. Interesting.
2. Just out of curiousity, what are you packing into the variable? If you are trying to pack the version into the package variable, that is not the way the packages action works. You specify the package name and then deal with the version separately. Without going back to read, I don't *think* variables are interpolated in any of that.
Maybe someone with a bit more fresh memory of the guts of cfengine can tell if there is any point where variables get interpolated automatically by the parser vs. having to be done everywhere they are used in the code.
Also, is there a huge need for variable interpolation to work in this area? I never thought about it, and I'm not sure if it would be harmful or not, although I'm guessing it wouldn't cause problems.
Phil D'Amore wrote:
Probably the easiest way to do this is something like this within cfengine:packages: <package_name> elsedefine=need_package shellcommands: need_package:: "your favorite install command here"This really works best with something that solves dependancies, like up2date, yum, or <insert favorite tool here>. Using rpm by itself works well only if you can be sure that the rpm command you fire off includes all the packages to solve deps on a single command line. Check the packages docs for other options like version checks.I'm supposed to be coming up with an option to packages that will just automatically install the package, but alas, my employer has had other plans for my time lately...Tim Nelson wrote:On Tue, 27 Apr 2004, Graham Allan wrote:I'm trying to write a method file to check if a particular RPM package is installed, and if not, install it.Is there some particular reason you aren't using RPM's built-in functionality? rpm -i and rpm -U both do this. :)
-- Phil D'Amore "Sometimes there is a fine line Senior System Administrator between criminally abusive Red Hat, Inc behavior and fun." Office: 919.754.3700 x44395 -- Ted the Generic Guy Pager: 877.383.8795 (Dilbert 4/19/2003)
[Prev in Thread] | Current Thread | [Next in Thread] |