Update upstream cookbooks
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# Author:: Nathan L Smith (<nathan@cramerdev.com>)
|
||||
#
|
||||
# Copyright 2011, Cramer Development, Inc.
|
||||
# Copyright:: 2011, Cramer Development, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -19,24 +19,49 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
actions :install
|
||||
attribute :source, String, name_attribute: true
|
||||
attribute :headers, Hash, default: {}
|
||||
attribute :prefix, String
|
||||
attribute :source_directory, String, default: '/usr/local/src'
|
||||
attribute :creates, String
|
||||
attribute :configure_flags, Array, default: []
|
||||
attribute :archive_name, String
|
||||
attribute :headers, Hash
|
||||
attribute :use_etag, [TrueClass, FalseClass], default: true
|
||||
attribute :use_last_modified, [TrueClass, FalseClass], default: true
|
||||
attribute :atomic_update, [TrueClass, FalseClass], default: true
|
||||
attribute :force_unlink, [TrueClass, FalseClass], default: false
|
||||
attribute :manage_symlink_source, [TrueClass, FalseClass]
|
||||
|
||||
attribute :source, :kind_of => String, :name_attribute => true
|
||||
attribute :headers, :kind_of => Hash, :default => {}
|
||||
attribute :prefix, :kind_of => String
|
||||
attribute :source_directory, :kind_of => String, :default => '/usr/local/src'
|
||||
attribute :creates, :kind_of => String
|
||||
attribute :configure_flags, :kind_of => Array, :default => []
|
||||
attribute :archive_name, :kind_of => String
|
||||
action :install do
|
||||
r = new_resource
|
||||
basename = r.archive_name || ::File.basename(r.name)
|
||||
dirname = basename.chomp('.tar.gz') # Assuming .tar.gz
|
||||
src_dir = r.source_directory
|
||||
|
||||
version = Chef::Version.new(Chef::VERSION[/^(\d+\.\d+\.\d+)/, 1])
|
||||
if version.major > 11 || (version.major == 11 && version.minor >= 6)
|
||||
attribute :headers, :kind_of => Hash, :default => nil
|
||||
attribute :use_etag, :kind_of => [TrueClass, FalseClass], :default => true
|
||||
attribute :use_last_modified, :kind_of => [TrueClass, FalseClass], :default => true
|
||||
attribute :atomic_update, :kind_of => [TrueClass, FalseClass], :default => true
|
||||
attribute :force_unlink, :kind_of => [TrueClass, FalseClass], :default => false
|
||||
attribute :manage_symlink_source, :kind_of => [TrueClass, FalseClass], :default => nil
|
||||
remote_file basename do
|
||||
source r.name
|
||||
path "#{src_dir}/#{basename}"
|
||||
backup false
|
||||
headers r.headers unless r.headers.nil?
|
||||
use_etag r.use_etag
|
||||
use_last_modified r.use_last_modified
|
||||
atomic_update r.atomic_update
|
||||
force_unlink r.force_unlink
|
||||
manage_symlink_source r.manage_symlink_source
|
||||
action :create_if_missing
|
||||
end
|
||||
|
||||
execute "extract #{basename}" do
|
||||
command "tar xfz #{basename}"
|
||||
cwd src_dir
|
||||
creates "#{src_dir}/#{dirname}"
|
||||
end
|
||||
|
||||
execute "compile & install #{dirname}" do
|
||||
flags = [r.prefix ? "--prefix=#{r.prefix}" : nil, *r.configure_flags].compact.join(' ')
|
||||
command "./configure --quiet #{flags} && make --quiet && make --quiet install"
|
||||
cwd "#{src_dir}/#{dirname}"
|
||||
creates r.creates
|
||||
end
|
||||
end
|
||||
|
||||
default_action :install
|
||||
|
||||
Reference in New Issue
Block a user