Update ark cookbook

This commit is contained in:
Greg Karékinian
2017-02-24 16:05:31 +01:00
parent 6075167494
commit af1718e44a
19 changed files with 310 additions and 101 deletions

View File

@@ -25,21 +25,28 @@ module Ark
end
def tar_binary
resource.run_context.node['ark']['tar']
@tar_binary ||= node['ark']['tar'] || case node['platform_family']
when 'mac_os_x', 'freebsd'
'/usr/bin/tar'
when 'smartos'
'/bin/gtar'
else
'/bin/tar'
end
end
def args
case resource.extension
when /^(tar)$/ then "xf"
when /^(tar.gz|tgz)$/ then "xzf"
when /^(tar.bz2|tbz)$/ then "xjf"
when /^(tar.xz|txz)$/ then "xJf"
when /^(tar)$/ then 'xf'
when /^(tar.gz|tgz)$/ then 'xzf'
when /^(tar.bz2|tbz)$/ then 'xjf'
when /^(tar.xz|txz)$/ then 'xJf'
else raise unsupported_extension
end
end
def strip_args
resource.strip_components > 0 ? " --strip-components=#{resource.strip_components}" : ""
resource.strip_components > 0 ? " --strip-components=#{resource.strip_components}" : ''
end
def unsupported_extension