Added util::extract::zip.
This commit is contained in:
parent
e6cf046de5
commit
90f11c2a58
1 changed files with 49 additions and 0 deletions
|
@ -63,6 +63,55 @@ define util::extract::tar($source, $ensure=present, $strip=0, $preserve=false) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Extract tar package.
|
||||||
|
#
|
||||||
|
# === Parameters
|
||||||
|
#
|
||||||
|
# $name:
|
||||||
|
# Destination directory.
|
||||||
|
# $ensure:
|
||||||
|
# If 'latest', remove target and re-extract when source file changes.
|
||||||
|
# $source:
|
||||||
|
# File to extract.
|
||||||
|
#
|
||||||
|
# === Sample usage
|
||||||
|
#
|
||||||
|
#util::extract::zip { "/usr/lib/firefox-addons/extensions/{73a6fe31-595d-460b-a920-fcc0f8843232}":
|
||||||
|
# source => "/usr/local/src/noscript.xpi",
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
define util::extract::zip($source, $ensure=present) {
|
||||||
|
|
||||||
|
case $ensure {
|
||||||
|
latest: {
|
||||||
|
exec { "zip-rmdir-${name}":
|
||||||
|
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||||
|
command => "rm -fr ${name}",
|
||||||
|
before => File["${name}"],
|
||||||
|
subscribe => File["${source}"],
|
||||||
|
refreshonly => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$command = "unzip ${source} -d ${name}"
|
||||||
|
|
||||||
|
file { "${name}":
|
||||||
|
ensure => directory,
|
||||||
|
mode => 0755,
|
||||||
|
owner => root,
|
||||||
|
group => root,
|
||||||
|
}
|
||||||
|
|
||||||
|
exec { "zip-extract-${name}":
|
||||||
|
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||||
|
command => $command,
|
||||||
|
require => File["${name}"],
|
||||||
|
unless => "test -n \"$(ls -A ${name})\"",
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Apply patch.
|
# Apply patch.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Reference in a new issue