21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'manifests/extpack.pp', line 21
define virtualbox::extpack (
String $source,
Enum['present', 'absent'] $ensure = 'present',
Boolean $verify_checksum = true,
Optional[String] $checksum_string = undef,
Enum['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512'] $checksum_type = 'md5',
Stdlib::Absolutepath $extpack_path = '/usr/lib/virtualbox/ExtensionPacks',
) {
if $verify_checksum {
$_checksum_type = $checksum_type
$_checksum_string = $checksum_string
} else {
$_checksum_type = undef
$_checksum_string = undef
}
$dest = "${extpack_path}/${name}"
archive { "/usr/src/${name}.tgz":
ensure => $ensure,
source => $source,
checksum => $_checksum_string,
checksum_type => $_checksum_type,
checksum_verify => $verify_checksum,
extract => false,
require => Class['virtualbox'],
}
case $ensure {
'present': {
exec { "${name} unpack":
command => "mkdir -p ${dest} && tar --no-same-owner --no-same-permissions -xzf /usr/src/${name}.tgz -C ${dest}",
creates => $dest,
timeout => 120,
path => $facts['path'],
require => Archive["/usr/src/${name}.tgz"],
}
}
'absent': {
file { $dest:
ensure => absent,
recurse => true,
purge => true,
force => true,
}
}
default: { fail('Unknown value for $ensure.') }
}
}
|