Use gtar on OpenBSD in util::extract::tar
This commit is contained in:
parent
4bc3dcedf6
commit
f774635313
1 changed files with 13 additions and 5 deletions
|
@ -38,8 +38,11 @@ define util::extract::tar($source, $ensure=present, $strip=0, $preserve=false) {
|
||||||
file { "${name}":
|
file { "${name}":
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
mode => 0755,
|
mode => 0755,
|
||||||
owner => root,
|
owner => "root",
|
||||||
group => root,
|
group => $operatingsystem ? {
|
||||||
|
"openbsd" => "wheel",
|
||||||
|
default => "root",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
case regsubst($source, '.*\.([^.]+)$', '\1') {
|
case regsubst($source, '.*\.([^.]+)$', '\1') {
|
||||||
|
@ -48,14 +51,19 @@ define util::extract::tar($source, $ensure=present, $strip=0, $preserve=false) {
|
||||||
bz2, tbz: { $cat = "bzcat" }
|
bz2, tbz: { $cat = "bzcat" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tar = $operatingsystem ? {
|
||||||
|
"openbsd" => "gtar",
|
||||||
|
default => "tar",
|
||||||
|
}
|
||||||
|
|
||||||
if $preserve {
|
if $preserve {
|
||||||
$command = "${cat} ${source} | tar xf - --strip-components=${strip} -C ${name}"
|
$command = "${cat} ${source} | ${tar} xf - --strip-components=${strip} -C ${name}"
|
||||||
} else {
|
} else {
|
||||||
$command = "${cat} ${source} | tar xf - --strip-components=${strip} -C ${name} --no-same-owner --no-same-permissions"
|
$command = "${cat} ${source} | ${tar} xf - --strip-components=${strip} -C ${name} --no-same-owner --no-same-permissions"
|
||||||
}
|
}
|
||||||
|
|
||||||
exec { "tar-extract-${name}":
|
exec { "tar-extract-${name}":
|
||||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
path => "/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin",
|
||||||
command => $command,
|
command => $command,
|
||||||
require => File["${name}"],
|
require => File["${name}"],
|
||||||
unless => "test -n \"$(ls -A ${name})\"",
|
unless => "test -n \"$(ls -A ${name})\"",
|
||||||
|
|
Loading…
Add table
Reference in a new issue