Added util::patch.
This commit is contained in:
parent
716569f782
commit
0478d65d21
1 changed files with 32 additions and 0 deletions
|
@ -40,3 +40,35 @@ define util::extract::tar($source, $strip=0) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Apply patch.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# $name:
|
||||
# Destination directory.
|
||||
# $source:
|
||||
# Patch file.
|
||||
# $strip:
|
||||
# Remove the specified number of leading path elements.
|
||||
# Defaults to 0.
|
||||
#
|
||||
# === Sample usage
|
||||
#
|
||||
# util::patch { "/usr/local/src/moin-1.8.8":
|
||||
# strip => 1,
|
||||
# source => "/usr/local/src/moin.patch",
|
||||
# }
|
||||
#
|
||||
define util::patch($source, $strip=0) {
|
||||
|
||||
exec { "patch-${name}-${source}":
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
cwd => "${name}",
|
||||
command => "patch -N -t -p${strip} < ${source}",
|
||||
onlyif => "patch --dry-run -N -t -p${strip} < ${source}",
|
||||
require => [ File["${name}"], File["${source}"], ],
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue