Skip to content

Commit

Permalink
add ugly bash if to check if a file to be cherry picked is in the base
Browse files Browse the repository at this point in the history
of the archive or a subdirectory
  • Loading branch information
bryanwb committed Jul 27, 2012
1 parent 5d93003 commit dcc0c25
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
45 changes: 27 additions & 18 deletions libraries/provider_ark.rb
Expand Up @@ -83,26 +83,30 @@ def action_configure
end

def action_build_with_make
set_paths
action_download
action_unpack
b = Chef::Resource::Script::Bash.new("build with make", run_context)
b.cwd new_resource.path
b.environment new_resource.environment
b.code "make #{new_resource.make_opts.join(' ')}"
b.run_action(:run)
action_set_owner new_resource.path
action_link_paths
action_install_binaries
unless new_resource.creates and ::File.exists? new_resource.creates
set_paths
action_download
action_unpack
b = Chef::Resource::Script::Bash.new("build with make", run_context)
b.cwd new_resource.path
b.environment new_resource.environment
b.code "make #{new_resource.make_opts.join(' ')}"
b.run_action(:run)
action_set_owner new_resource.path
action_link_paths
action_install_binaries
end
end

def action_install_with_make
action_build_with_make
b = Chef::Resource::Script::Bash.new("make install", run_context)
b.cwd new_resource.path
b.environment new_resource.environment
b.code "make install"
b.run_action(:run)
unless new_resource.creates and ::File.exists? new_resource.creates
action_build_with_make
b = Chef::Resource::Script::Bash.new("make install", run_context)
b.cwd new_resource.path
b.environment new_resource.environment
b.code "make install"
b.run_action(:run)
end
end

# needs a test, start here http://guide.python-distribute.org/quickstart.html
Expand Down Expand Up @@ -305,7 +309,12 @@ def unzip_dump
def unzip_cherry_pick
b = Chef::Resource::Script::Bash.new(new_resource.name, run_context)
b.code <<-EOS
unzip -j -o #{new_resource.release_file} "*/#{new_resource.creates}" -d #{new_resource.path}
unzip -t #{new_resource.release_file} "*/#{new_resource.creates}"
if [ $? -eq 11 ] ; then
unzip -j -o #{new_resource.release_file} "#{new_resource.creates}" -d #{new_resource.path}
else
unzip -j -o #{new_resource.release_file} "*/#{new_resource.creates}" -d #{new_resource.path}
fi
EOS
b.run_action(:run)
end
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Expand Up @@ -3,7 +3,7 @@
license "Apache 2.0"
description "Installs/Configures ark"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.0.11"
version "0.0.13"

%w{ debian ubuntu centos redhat fedora }.each do |os|
supports os
Expand Down

0 comments on commit dcc0c25

Please sign in to comment.