On Mon, 2012-07-30 at 14:51 -0700, Eugene Kirpichov wrote:
> Hello puppet-users,
>
> I need to use puppet to install a slightly modified version of a
> package (modify a few lines in the scripts it installs), but I don't
> want to build my own version of the package and distribute it via a
> private package repository because this seems too heavyweight.
>
> What's the common way to do this? I have a few things in mind:
> * Add an exec task to patch the files. Pro: seems like the right way.
> Con: how do I detect if the patch is already applied? (should I just
> force-reinstall the base package before patching?)
The easiest way to do this sort of thing is to add some sort of marker
keyword to the file when the patch is applied. Then you can use a
resource like
exec { 'patch script':
unless => 'grep MARKER_KEYWORD /path/to/script',
command => 'patch /path/to/script some-patch',
require => [ Package['thepackage'], File['some-patch'] ],
}
If the package will always be installed and upgraded through puppet, you
might consider making the exec 'refreshonly' and notifying it from the
package resource.
--
Calvin Walton <
calvin...@kepstin.ca>