On Wed, Apr 28, 2010 at 04:45:01AM -0400, Marc Baudoin wrote:
>But I also want other packages to be removed.  Ideally, packages
>installed as dependencies of those listed in $(match_package)
>should be handled automatically so they don't have to be listed
>explicitely but it depends heavily on which package manager is
>used.  So, supposing every required package (and their
>dependencies) is listed in $(match_package), how can I have any
>other one removed?
>
>Intuitively, I'd like to be able to add something like that to my
>bundle:
>
>packages:
>       not "$(match_package)"
>               package_policy => "delete" ,
>               package_method => generic ;
>
>But I haven't found the right syntax to use (I may have missed
>something in the documentation, as it's quite hard for a
>newcomer).
>
>Is there a way to do that?

I've used this on systems running Yum (package lists shortened for
brevity):

bundle agent security {
vars:

   Kluster::
     "bluetooth_packages" slist => {
         "bluez-gnome",
         "bluez-libs",
         "bluez-utils",
     };
     "packages_32bit" slist => {
         "avahi.i386",
         "aspell.i386",
         "perl.i386",
        };

     "packages_to_remove" slist => {
         @{bluetooth_packages},
         @{packages_32bit},
     };

commands:
     Kluster::
         # This is done outside of packages: because the 'yum'
         # Method actually just calls 'rpm'.  Yum is a bit more graceful
         # and can yank all packages listed above.  It is also a bit
         # more efficient to pass a string to yum, instead of iterating
         # over a list.
         "${g.yum} remove -y ${packages_to_remove_string}"
             comment => "Remove packages unconditionally",
             action  => if_elapsed('3600');
}


-- 
Jesse Becker
NHGRI Linux support (Digicon Contractor)
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to