Created
June 2, 2011 20:13
-
-
Save ricardovf/1005206 to your computer and use it in GitHub Desktop.
Chef recipe to download tarballs, extract, and compile them.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: mono | |
# Recipe:: install-mono | |
# | |
# Copyright 2011, Medidata Solutions, Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
# Update existing system packages | |
# NOTE: Find a way to put this functionality into the apt cookbook and call it from here! | |
# Also NOTE: find a way to trigger these only if we're actually going to do the install | |
#execute "apt-get-update" do | |
# command "apt-get update" | |
#end | |
# | |
#execute "apt-get-upgrade" do | |
# command "apt-get upgrade -y" | |
#end | |
extract_script = (Pathname.new(node[:mono][:temp_dir]) + 'extract-source.sh').to_s | |
install_script = (Pathname.new(node[:mono][:temp_dir]) + 'install-mono.sh').to_s | |
# Install prereq packages | |
node[:mono][:pack_list].each do |pkg| | |
package pkg | |
end | |
# Create tempdir for tarball ops | |
directory node[:mono][:temp_dir] do | |
recursive true | |
owner 'root' | |
group 'root' | |
mode '0644' | |
action :create | |
end | |
# Download tarballs from S3 | |
node[:mono][:tarballs].each do |pkg| | |
remote_file "#{node[:mono][:temp_dir]}/#{pkg[:tarball]}.tar.bz2" do | |
source "#{pkg[:url]}" | |
owner "root" | |
group "root" | |
mode "0644" | |
notifies :create, "template[#{extract_script}]" | |
end | |
end | |
# Get array of all tarballs | |
tarball_list = Array.new | |
dir_list = Array.new | |
node[:mono][:tarballs].each do |pkg| | |
tarball_list << pkg[:tarball] + ".tar.bz2" | |
dir_list << pkg[:tarball] | |
end | |
# Write out an extract script to untar all the tarballs | |
template extract_script do | |
source 'extract-source.sh.erb' | |
owner 'root' | |
group 'root' | |
mode '0755' | |
variables({ | |
:package_dir => node[:mono][:temp_dir], | |
:package_names => tarball_list | |
}) | |
action :create_if_missing | |
notifies :run, "bash[extract-source]" | |
end | |
# Run the extract script - only runs if notified with :run by extract_script template indicating pkgs have | |
# changed. | |
bash 'extract-source' do | |
code extract_script | |
user 'root' | |
action :nothing | |
end | |
# configure/make/make install each tarball. | |
dir_list.each do |dir| | |
bash "install-#{dir}" do | |
Chef::Log.info("Installing #{dir} tarball...") | |
user 'root' | |
cwd "#{node[:mono][:temp_dir]}/#{dir}" | |
code <<-EOH | |
./configure --prefix=#{node[:mono][:prefix]} | |
make | |
make install | |
EOH | |
action :nothing | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Thu, 02 Jun 2011 19:52:27 +0000] INFO: Starting Chef Run (Version 0.9.12) | |
[Thu, 02 Jun 2011 19:52:29 +0000] INFO: RsyslogImfile light-weight provider already initialized -- overriding! | |
[Thu, 02 Jun 2011 19:52:29 +0000] INFO: AptRepository light-weight provider already initialized -- overriding! | |
[Thu, 02 Jun 2011 19:52:29 +0000] INFO: RsyslogTextlog light-weight resource already initialized -- overriding! | |
[Thu, 02 Jun 2011 19:52:29 +0000] INFO: AptRepository light-weight resource already initialized -- overriding! | |
[Thu, 02 Jun 2011 19:52:29 +0000] INFO: Running under Ruby v1.8.7, patch level 249 | |
[Thu, 02 Jun 2011 19:52:30 +0000] INFO: Ran execute[apt-get update] successfully | |
[Thu, 02 Jun 2011 19:52:31 +0000] INFO: Installing mono-2.10.2.tar.bz2 tarball... | |
[Thu, 02 Jun 2011 19:52:31 +0000] INFO: Installing libgdiplus-2.10.tar.bz2 tarball... | |
[Thu, 02 Jun 2011 19:52:31 +0000] INFO: Installing gtk-sharp-2.12.10.tar.bz2 tarball... | |
[Thu, 02 Jun 2011 19:52:31 +0000] INFO: Installing xsp-2.10.2.tar.bz2 tarball... | |
[Thu, 02 Jun 2011 19:52:31 +0000] INFO: Installing mod_mono-2.10.tar.bz2 tarball... | |
[Thu, 02 Jun 2011 19:52:33 +0000] INFO: Creating directory[/tmp/mono] at /tmp/mono | |
[Thu, 02 Jun 2011 19:52:33 +0000] INFO: Setting owner to 0 for directory[/tmp/mono] | |
[Thu, 02 Jun 2011 19:52:33 +0000] INFO: Setting group to 0 for directory[/tmp/mono] | |
[Thu, 02 Jun 2011 19:52:33 +0000] INFO: Setting mode to 644 for directory[/tmp/mono] | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: remote_file[/tmp/mono/mono-2.10.2.tar.bz2.tar.bz2]: Creating /tmp/mono/mono-2.10.2.tar.bz2.tar.bz2 | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: Setting owner to 0 for remote_file[/tmp/mono/mono-2.10.2.tar.bz2.tar.bz2] | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: Setting group to 0 for remote_file[/tmp/mono/mono-2.10.2.tar.bz2.tar.bz2] | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: Setting mode to 644 for remote_file[/tmp/mono/mono-2.10.2.tar.bz2.tar.bz2] | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: remote_file[/tmp/mono/libgdiplus-2.10.tar.bz2.tar.bz2]: Creating /tmp/mono/libgdiplus-2.10.tar.bz2.tar.bz2 | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: Setting owner to 0 for remote_file[/tmp/mono/libgdiplus-2.10.tar.bz2.tar.bz2] | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: Setting group to 0 for remote_file[/tmp/mono/libgdiplus-2.10.tar.bz2.tar.bz2] | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: Setting mode to 644 for remote_file[/tmp/mono/libgdiplus-2.10.tar.bz2.tar.bz2] | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: remote_file[/tmp/mono/libgdiplus-2.10.tar.bz2.tar.bz2] not queuing delayed action create on template[/tmp/mono/extract-source.sh] (delayed), as it's already been queued | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: remote_file[/tmp/mono/gtk-sharp-2.12.10.tar.bz2.tar.bz2]: Creating /tmp/mono/gtk-sharp-2.12.10.tar.bz2.tar.bz2 | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: Setting owner to 0 for remote_file[/tmp/mono/gtk-sharp-2.12.10.tar.bz2.tar.bz2] | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: Setting group to 0 for remote_file[/tmp/mono/gtk-sharp-2.12.10.tar.bz2.tar.bz2] | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: Setting mode to 644 for remote_file[/tmp/mono/gtk-sharp-2.12.10.tar.bz2.tar.bz2] | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: remote_file[/tmp/mono/gtk-sharp-2.12.10.tar.bz2.tar.bz2] not queuing delayed action create on template[/tmp/mono/extract-source.sh] (delayed), as it's already been queued | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: remote_file[/tmp/mono/xsp-2.10.2.tar.bz2.tar.bz2]: Creating /tmp/mono/xsp-2.10.2.tar.bz2.tar.bz2 | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: Setting owner to 0 for remote_file[/tmp/mono/xsp-2.10.2.tar.bz2.tar.bz2] | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: Setting group to 0 for remote_file[/tmp/mono/xsp-2.10.2.tar.bz2.tar.bz2] | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: Setting mode to 644 for remote_file[/tmp/mono/xsp-2.10.2.tar.bz2.tar.bz2] | |
[Thu, 02 Jun 2011 19:52:35 +0000] INFO: remote_file[/tmp/mono/xsp-2.10.2.tar.bz2.tar.bz2] not queuing delayed action create on template[/tmp/mono/extract-source.sh] (delayed), as it's already been queued | |
[Thu, 02 Jun 2011 19:52:36 +0000] INFO: remote_file[/tmp/mono/mod_mono-2.10.tar.bz2.tar.bz2]: Creating /tmp/mono/mod_mono-2.10.tar.bz2.tar.bz2 | |
[Thu, 02 Jun 2011 19:52:36 +0000] INFO: Setting owner to 0 for remote_file[/tmp/mono/mod_mono-2.10.tar.bz2.tar.bz2] | |
[Thu, 02 Jun 2011 19:52:36 +0000] INFO: Setting group to 0 for remote_file[/tmp/mono/mod_mono-2.10.tar.bz2.tar.bz2] | |
[Thu, 02 Jun 2011 19:52:36 +0000] INFO: Setting mode to 644 for remote_file[/tmp/mono/mod_mono-2.10.tar.bz2.tar.bz2] | |
[Thu, 02 Jun 2011 19:52:36 +0000] INFO: remote_file[/tmp/mono/mod_mono-2.10.tar.bz2.tar.bz2] not queuing delayed action create on template[/tmp/mono/extract-source.sh] (delayed), as it's already been queued | |
[Thu, 02 Jun 2011 19:52:36 +0000] INFO: Storing updated cookbooks/mono/templates/ubuntu-10.04/extract-source.sh.erb in the cache. | |
[Thu, 02 Jun 2011 19:52:36 +0000] INFO: Writing updated content for template[/tmp/mono/extract-source.sh] to /tmp/mono/extract-source.sh | |
[Thu, 02 Jun 2011 19:52:36 +0000] INFO: remote_file[/tmp/mono/mono-2.10.2.tar.bz2.tar.bz2] sending create action to template[/tmp/mono/extract-source.sh] (delayed) | |
[Thu, 02 Jun 2011 19:52:36 +0000] INFO: template[/tmp/mono/extract-source.sh] sending run action to bash[extract-source] (delayed) | |
[Thu, 02 Jun 2011 19:53:47 +0000] INFO: Ran bash[extract-source] successfully | |
[Thu, 02 Jun 2011 19:53:48 +0000] INFO: Chef Run complete in 81.345777 seconds | |
[Thu, 02 Jun 2011 19:53:48 +0000] INFO: cleaning the checksum cache | |
[Thu, 02 Jun 2011 19:53:48 +0000] INFO: Running report handlers | |
[Thu, 02 Jun 2011 19:53:48 +0000] INFO: Report handlers complete | |
[Thu, 02 Jun 2011 19:58:59 +0000] INFO: Starting Chef Run (Version 0.9.12) | |
[Thu, 02 Jun 2011 19:59:02 +0000] INFO: RsyslogImfile light-weight provider already initialized -- overriding! | |
[Thu, 02 Jun 2011 19:59:02 +0000] INFO: AptRepository light-weight provider already initialized -- overriding! | |
[Thu, 02 Jun 2011 19:59:02 +0000] INFO: RsyslogTextlog light-weight resource already initialized -- overriding! | |
[Thu, 02 Jun 2011 19:59:02 +0000] INFO: AptRepository light-weight resource already initialized -- overriding! | |
[Thu, 02 Jun 2011 19:59:03 +0000] INFO: Running under Ruby v1.8.7, patch level 249 | |
[Thu, 02 Jun 2011 19:59:03 +0000] INFO: Ran execute[apt-get update] successfully | |
[Thu, 02 Jun 2011 19:59:05 +0000] INFO: Installing mono-2.10.2.tar.bz2 tarball... | |
[Thu, 02 Jun 2011 19:59:05 +0000] INFO: Installing libgdiplus-2.10.tar.bz2 tarball... | |
[Thu, 02 Jun 2011 19:59:05 +0000] INFO: Installing gtk-sharp-2.12.10.tar.bz2 tarball... | |
[Thu, 02 Jun 2011 19:59:05 +0000] INFO: Installing xsp-2.10.2.tar.bz2 tarball... | |
[Thu, 02 Jun 2011 19:59:05 +0000] INFO: Installing mod_mono-2.10.tar.bz2 tarball... | |
[Thu, 02 Jun 2011 19:59:12 +0000] INFO: Chef Run complete in 12.565559 seconds | |
[Thu, 02 Jun 2011 19:59:12 +0000] INFO: cleaning the checksum cache | |
[Thu, 02 Jun 2011 19:59:12 +0000] INFO: Removing cookbooks/mono/templates/ubuntu-10.04/extract-source.sh.erb from the cache; it is no longer on the server. | |
[Thu, 02 Jun 2011 19:59:12 +0000] INFO: Running report handlers | |
[Thu, 02 Jun 2011 19:59:12 +0000] INFO: Report handlers complete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any chance you could post the contents of 'extract-source.sh.erb' as well?