Skip to content

Commit

Permalink
Install s3cmd from source so that we aren't bound to whatever comes w…
Browse files Browse the repository at this point in the history
…ith a given linux distribution.
  • Loading branch information
freerobby committed Jul 18, 2012
1 parent 24a306e commit 75ff741
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
4 changes: 4 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
# S3 credentials
default[:s3cmd][:aws_access_key_id] = ""
default[:s3cmd][:aws_secret_access_key] = ""

default[:s3cmd][:version] = "v1.1.0-beta3"
default[:s3cmd][:user] = "root"
default[:s3cmd][:install_prefix_root] = "/usr/local"
29 changes: 22 additions & 7 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,36 @@
# Recipe:: default
#

#install s3cmd
package "s3cmd" do
action :upgrade
package "git"
package "python-setuptools"

git "#{node[:s3cmd][:install_prefix_root]}/share/s3cmd" do
repository "git://github.com/s3tools/s3cmd.git"
reference node[:s3cmd][:version]
action :sync
end

execute "build_s3cmd" do
user node[:s3cmd][:user]
cwd "#{node[:s3cmd][:install_prefix_root]}/share/s3cmd"
command "python setup.py install"
action :run
end

# Link the binary to the one we built
link "#{node[:s3cmd][:install_prefix_root]}/bin/s3cmd" do
to "#{node[:s3cmd][:install_prefix_root]}/share/s3cmd/s3cmd"
action :create
end

#deploy configuration for each user. Change s3cfg.erb template in your site cookbook to set
#you access key and secret.
node[:s3cmd][:users].each do |user|

node[:s3cmd][:users].each do |user|
home = user.to_s == :root.to_s ? "/root" : "/home/#{user}"

template "s3cfg" do
path "#{home}/.s3cfg"
source "s3cfg.erb"
mode 0655
end
end
end
end

0 comments on commit 75ff741

Please sign in to comment.