Mark Burgess wrote:
The source is the .texinfo files
Here's a patch that matches 2.2.1 functionality today.
Obviously I'll be updating this as we implement smarter upgrade
functions for other package managers.
--
Jo Rhett
senior geek
Silicon Valley Colocation
--- cfengine-Reference.texinfo_orig Thu May 31 10:24:55 2007
+++ cfengine-Reference.texinfo Thu May 31 10:56:02 2007
@@ -2750,7 +2750,7 @@
netconfig # check net interface config
resolve # check resolver setup
unmount # unmount any filesystems
- packages # check for required packages
+ packages # install/upgrade/remove packages
shellcommands # execute shell commands
editfiles # edit files
addmounts # add new filesystems to system
@@ -2905,8 +2905,8 @@
of the program. This will query the system's package database
for the specified packages, at the specified versions, set
classes based on whether or not those packages exist, and
-optionally install those packages using a pre-defined package
-manager command.
+optionally install, upgrade or remove those packages using a
+pre-defined package manager command.
@item shellcommands
executes all the commands defined under the @code{shellcommands}
@@ -3481,8 +3481,8 @@
By default, this variable is not set, meaning that any packages with
action=install will NOT be installed if installation is required. Note
-the "'s around the string, and the %s is replaced with the list of
-packages to be installed, each separated by a ' ' (space).
+the "'s around the string, and the %s is replaced with the name of the
+package to be installed.
@c .....................................................
@c SUBSECTION
@@ -3655,7 +3655,7 @@
@c SUBSECTION
@c .....................................................
[EMAIL PROTECTED] ExpireAfter, FullEncryption, excludelinks, control
[EMAIL PROTECTED] ExpireAfter, FreeBSDInstallCommand, excludelinks, control
@subsection ExpireAfter
If you change the value of this parameter, it should be one of the
@@ -3700,6 +3700,46 @@
@c SUBSECTION
@c .....................................................
[EMAIL PROTECTED] FreeBSDInstallCommand, FreeBSDRemoveCommand, ExpireAfter,
control
[EMAIL PROTECTED] FreeBSDInstallCommand
+
+Sets the path to `pkg_add' which is used to install packages that need
+to be installed under FreeBSD.
+
[EMAIL PROTECTED]
+
+ FreeBSDInstallCommand = ( "/usr/sbin/pkg_add -r %s" )
+
[EMAIL PROTECTED] smallexample
+
+By default, this variable is not set, meaning that any packages with
+action=install will NOT be installed. Note the quotes around the string,
+and the @code{%s} is replaced with the name of the package to be installed.
+
[EMAIL PROTECTED] .....................................................
[EMAIL PROTECTED] SUBSECTION
[EMAIL PROTECTED] .....................................................
+
[EMAIL PROTECTED] FreeBSDRemoveCommand, FullEncryption, FreeBSDInstallCommand,
control
[EMAIL PROTECTED] FreeBSDRemoveCommand
+
+Sets the path to `pkg_delete' which is used to remove packages that need
+to be uninstalled under FreeBSD.
+
[EMAIL PROTECTED]
+
+ FreeBSDRemoveCommand = ( "/usr/sbin/pkg_delete %s" )
+
[EMAIL PROTECTED] smallexample
+
+By default, this variable is set to /usr/sbin/pkg_delete, meaning that any
+packages with action=remove will be removed. Note the quotes around the
+string, and the @code{%s} is replaced with the name of the package to be
installed.
+
[EMAIL PROTECTED] .....................................................
[EMAIL PROTECTED] SUBSECTION
[EMAIL PROTECTED] .....................................................
+
@node FullEncryption, homepattern, ExpireAfter, control
@subsection FullEncryption
@@ -4282,8 +4322,8 @@
By default, this variable is not set, meaning that any packages with
action=install will NOT be installed if installation is required. Note
-the quotes around the string, and the @code{%s} is replaced with the list of
-packages to be installed, each separated by a space.
+the quotes around the string, and the @code{%s} is replaced with the name
+of the package to be installed.
@c .....................................................
@c SUBSECTION
@@ -4354,8 +4394,8 @@
By default, this variable is not set, meaning that any packages with
action=install will NOT be installed if installation is required. Note
-the "'s around the string, and the %s is replaced with the list of
-packages to be installed, each separated by a ' ' (space).
+the quotes around the string, and the @code{%s} is replaced with the name
+of the package to be installed.
@c .....................................................
@c SUBSECTION
@@ -4677,8 +4717,8 @@
By default, this variable is not set, meaning that any packages with
action=install will NOT be installed if installation is required. Note
-the "'s around the string, and the %s is replaced with the list of
-packages to be installed, each separated by a ' ' (space).
+the quotes around the string, and the @code{%s} is replaced with the name
+of the package to be installed.
@c .....................................................
@c SUBSECTION
@@ -9518,40 +9558,46 @@
@item freebsd
@cindex FreeBSD Package Database Queries
-Jo Rhett who implemented this writes:
-It works like this:
+FreeBSD has fully working install/upgrade/delete management for
+packages.
@smallexample
control:
DefaultPkgMgr = ( freebsd )
- FreeBSDInstallCommand = ( "/var/cfengine/packages/pkginstall %s" )
+ FreeBSDInstallCommand = ( "/usr/sbin/pkg_add -r %s" )
+ FreeBSDRemoveCommand = ( "/usr/sbin/pkg_delete %s" )
packages:
- bsdsar-1.10_2 action=install
+ # install new package version 1.10_2
+ newpackage-1.10_2 action=install
version=1.10_2
cmp=ge
[EMAIL PROTECTED] smallexample
-
-Note that specifying the version of the package that is part of the freebsd
package filename is required. However, it does not use this for comparison,
just for the package to install. So you could install 1.10 only if nothing
larger than 1.0 was installed.
-
[EMAIL PROTECTED]
-packages:
- bsdsar-1.10_2 action=install
- version=1.0
+ # upgrade any installed versions of compromised to at least 1.2
+ compromised-1.2 action=upgrade
+ version=1.2
+ cmp=le
+
+ # remove any version of useless
+ useless action=remove
+ version=0.1
cmp=ge
@end smallexample
+
+Note that specifying the version of the package that is part of the freebsd
package filename is required. However, it does not use this for comparison,
just for the package filename to install. For instance, the example above
install 1.10 only if nothing larger than 1.10 was installed.
+
You can also backgrade if you know that 1.2 is bad for instance.
@smallexample
packages:
- bsdsar-1.10_2 action=install
- version=1.1
+ bsdsar-1.10_2 action=upgrade
+ version=1.10_2
cmp=gt
@end smallexample
-Now, due to the unfortunate fact that freebsd doesn't provide a
+The only gotcha about FreeBSD installation is trying to specify the package
+source location. Due to the unfortunate fact that freebsd doesn't provide a
command line option -- only an environment variable -- for specifying
the source repository, you have a few options.
@@ -9559,8 +9605,15 @@
@smallexample
FreeBSDInstallCommand = ( "pkg_add -r %s" )
[EMAIL PROTECTED] smallexample
+
+Get it from a mounted directory
+
[EMAIL PROTECTED]
+ FreeBSDInstallCommand = ( "pkg_add /nfs/packages/%s" )
@end smallexample
+
Or write a script that tells pkg_add where to find it, like so:
@smallexample
@@ -9574,32 +9627,20 @@
export PACKAGESITE
/usr/sbin/pkg_add -r $*
@end smallexample
-or even
-
[EMAIL PROTECTED]
-#!/bin/sh
-cd /my/local/repository
-for pkg in $*
-/usr/sbin/pkg_add [EMAIL PROTECTED]@}.tbz
-
[EMAIL PROTECTED] smallexample
-
-
-
@end table
@item define
-Specifies the list of classes to define if the specified package is
-installed.
+Specifies the list of classes to define if the specified package was
+installed (prior to actions taken if any)
@item elsedefine
-Specifies the list of classes to define if the specified package is not
-installed.
+Specifies the list of classes to define if the specified package was not
+installed (prior to actions taken if any)
@item action
Specifies whether the packages should actually do anything about the
situation it finds. The default for this is to do nothing. Of course,
-the classes in @code{define} and @code{elsedefine} will alwass be defined,
+the classes in @code{define} and @code{elsedefine} will always be defined,
as applicable, regardless of the action specified.
@table @code
@@ -9618,6 +9659,12 @@
@item
SUN -
SUNInstallCommand
[EMAIL PROTECTED]
+Gentoo -
+PortageInstallCommand
[EMAIL PROTECTED]
+FreeBSD -
+FreeBSDInstallCommand
@end itemize
Each variable is of the format:
@@ -9626,12 +9673,39 @@
FOOInstallCommand = ( "/usr/bin/foo --args %s --more-args" )
@end smallexample
-The ---args are of course optional. The %s is replaced with a space-separated
-list of the package names that were checked, and found to not be installed.
+The ---args are of course optional. The %s is replaced with the package name
+that was checked, and found to not be installed.
+
[EMAIL PROTECTED] upgrade
+Upgrades the package using the commands associated with the selected
+package manager, if a matching package is found on the system at the requested
+version, as follows:
+
[EMAIL PROTECTED] @bullet
[EMAIL PROTECTED]
+FreeBSD -
+FreeBSDRemoveCommand followed by FreeBSDInstallCommand
[EMAIL PROTECTED] itemize
@item remove
-CURRENTLY PARSED BUT NOT IMPLEMENTED
[EMAIL PROTECTED] table
+Removes the package using the command associated with the selected
+package manager, if a matching package is found on the system at the requested
+version, as follows:
+
[EMAIL PROTECTED] @bullet
[EMAIL PROTECTED]
+FreeBSD -
+FreeBSDRemoveCommand
[EMAIL PROTECTED] itemize
+
+Each variable is of the format:
+
[EMAIL PROTECTED]
+FOORemoveCommand = ( "/usr/bin/foo --args %s --more-args" )
[EMAIL PROTECTED] smallexample
+
+The ---args are of course optional. The %s is replaced with a space-separated
+list of the package names that were checked, and found to be installed.
@end table
@noindent
@@ -9642,7 +9716,7 @@
be defined @b{regardless} of whether or not the install was successful.
Assuming the package installed, the next run of cfagent will pick up that
fact. This has to be done since the package installs are batched, so there
-is no reliable way to know if a given package was installed.
+is no reliable way to know if a given package was installed successfully.
@noindent
Examples:
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine