-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cookbooks for build-tools, curl, dmg, firefox, chrome, homebrew, libx…
…ml2, mysql, openssl, readline, rvm, skype and zlib
- Loading branch information
Showing
28 changed files
with
700 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
description "Installs C compiler / build tools" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
if node[:platform] == 'mac_os_x' | ||
bash "checking for gcc (Xcode)" do | ||
code "gcc -v || { echo 'Please install Xcode' && exit 1; }" | ||
end | ||
else | ||
case node[:platform] | ||
when "ubuntu" | ||
%w{build-essential binutils-doc}.each do |pkg| | ||
package pkg | ||
end | ||
|
||
when "fedora" | ||
%w{gcc gcc-c++ kernel-devel make}.each do |pkg| | ||
package pkg | ||
end | ||
end | ||
|
||
package "autoconf" | ||
package "flex" | ||
package "bison" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
description "Installs curl" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package 'curl' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
Description | ||
=========== | ||
|
||
Lightweight resource and provider to install OS X applications (.app) from dmg files. | ||
|
||
Changes | ||
======= | ||
|
||
## v0.6.0: | ||
|
||
- option to install software that is an .mpkg inside a .dmg | ||
- ignore failure on chmod in case mode is already set, or is root owned | ||
|
||
Requirements | ||
============ | ||
|
||
## Platform: | ||
|
||
* Mac OS X | ||
|
||
Resources and Providers | ||
======================= | ||
|
||
dmg\_package | ||
------------ | ||
|
||
This resource will install a DMG "Package". It will retrieve the DMG from a remote URL, mount it using OS X's `hdid`, copy the application (.app directory) to the specified destination (/Applications), and detach the image using `hdiutil`. The dmg file will be stored in the `Chef::Config[:file_cache_path]`. If you want to install an application that has already been downloaded (not using the `source` parameter), copy it to the appropriate location. You can find out what directory this is with the following command on the node to run chef: | ||
|
||
knife exec -E 'p Chef::Config[:file_cache_path]' -c /etc/chef/client.rb | ||
|
||
Optionally, the LWRP can install an "mpkg" package using installer(8). | ||
|
||
# Actions: | ||
|
||
* :install - Installs the application. | ||
|
||
# Parameter attributes: | ||
|
||
* `app` - This is the name of the application used by default for the /Volumes directory and the .app directory copied to /Applications. | ||
* `source` - remote URL for the dmg to download if specified. Default is nil. | ||
* `destination` - directory to copy the .app into. Default is /Applications. | ||
* `checksum` - sha256 checksum of the dmg to download. Default is nil. | ||
* `type` - type of package, "app" or "mpkg". Default is "app". When using "mpkg", the destination must be /Applications. | ||
* `volumes_dir` - Directory under /Volumes where the dmg is mounted. Not all dmgs are mounted into a /Volumes location matching the name of the dmg. If not specified, this will use the name attribute. | ||
* `dmg_name` - Specify the name of the dmg if it is not the same as `app`, or if the name has spaces. | ||
|
||
Usage Examples | ||
============== | ||
|
||
Install `/Applications/Tunnelblick.app` from the primary download site. | ||
|
||
dmg_package "Tunnelblick" do | ||
source "http://tunnelblick.googlecode.com/files/Tunnelblick_3.1.2.dmg" | ||
checksum "a3fae60b6833175f32df20c90cd3a3603a" | ||
action :install | ||
end | ||
|
||
Install Google Chrome. Uses the `dmg_name` because the application name has spaces. Installs in `/Applications/Google Chrome.app`. | ||
|
||
dmg_package "Google Chrome" do | ||
dmg_name "googlechrome" | ||
source "https://dl-ssl.google.com/chrome/mac/stable/GGRM/googlechrome.dmg" | ||
checksum "7daa2dc5c46d9bfb14f1d7ff4b33884325e5e63e694810adc58f14795165c91a" | ||
action :install | ||
end | ||
|
||
Install Dropbox. Uses `volumes_dir` because the mounted directory is different than the name of the application directory. Installs in `/Applications/Dropbox.app`. | ||
|
||
dmg_package "Dropbox" do | ||
volumes_dir "Dropbox Installer" | ||
source "http://www.dropbox.com/download?plat=mac" | ||
checksum "b4ea620ca22b0517b75753283ceb82326aca8bc3c86212fbf725de6446a96a13" | ||
action :install | ||
end | ||
|
||
Install MacIrssi to `~/Applications` from the local file downloaded to the cache path into an Applications directory in the current user's home directory. Chef should run as a non-root user for this. | ||
|
||
directory "#{ENV['HOME']}/Applications" | ||
|
||
dmg_package "MacIrssi" do | ||
destination "#{ENV['HOME']}/Applications" | ||
action :install | ||
end | ||
|
||
Install Virtualbox to `/Applications` from the .mpkg: | ||
|
||
dmg_package "Virtualbox" do | ||
source "http://dlc.sun.com.edgesuite.net/virtualbox/4.0.8/VirtualBox-4.0.8-71778-OSX.dmg" | ||
type "mpkg" | ||
end | ||
|
||
To do | ||
===== | ||
|
||
A few things remain outstanding to make this cookbook "1.0" quality. | ||
|
||
* support downloading a .dmg.zip and unzipping it | ||
* specify a local .dmg already downloaded in another location (like ~/Downloads) | ||
|
||
Some things that would be nice to have at some point. | ||
|
||
* use hdiutil to mount/attach the disk image | ||
* automatically detect the `volumes_dir` where the image is attached | ||
* be able to automatically accept license agreements | ||
|
||
License and Author | ||
================== | ||
|
||
* Copyright 2011, Joshua Timberman <cookbooks@housepub.org> | ||
|
||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# Cookbook Name:: dmg | ||
# Attributes:: default | ||
# | ||
# Copyright 2011, Joshua Timberman | ||
# | ||
# 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. | ||
# | ||
default[:dmg][:base_dir] = "/Applications" | ||
default[:dmg][:cache_dir] = Chef::Config[:file_cache_path] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "dmg", | ||
"description": "LWRP to install OS X applications from dmgs", | ||
"long_description": "Description\n===========\n\nLightweight resource and provider to install OS X applications (.app) from dmg files.\n\nChanges\n=======\n\n## v0.6.0:\n\n- option to install software that is an .mpkg inside a .dmg\n- ignore failure on chmod in case mode is already set, or is root owned\n\nRequirements\n============\n\n## Platform:\n\n* Mac OS X\n\nResources and Providers\n=======================\n\ndmg\\_package\n------------\n\nThis resource will install a DMG \"Package\". It will retrieve the DMG from a remote URL, mount it using OS X's `hdid`, copy the application (.app directory) to the specified destination (/Applications), and detach the image using `hdiutil`. The dmg file will be stored in the `Chef::Config[:file_cache_path]`. If you want to install an application that has already been downloaded (not using the `source` parameter), copy it to the appropriate location. You can find out what directory this is with the following command on the node to run chef:\n\n knife exec -E 'p Chef::Config[:file_cache_path]' -c /etc/chef/client.rb\n\nOptionally, the LWRP can install an \"mpkg\" package using installer(8).\n\n# Actions:\n\n* :install - Installs the application.\n\n# Parameter attributes:\n\n* `app` - This is the name of the application used by default for the /Volumes directory and the .app directory copied to /Applications.\n* `source` - remote URL for the dmg to download if specified. Default is nil.\n* `destination` - directory to copy the .app into. Default is /Applications.\n* `checksum` - sha256 checksum of the dmg to download. Default is nil.\n* `type` - type of package, \"app\" or \"mpkg\". Default is \"app\". When using \"mpkg\", the destination must be /Applications.\n* `volumes_dir` - Directory under /Volumes where the dmg is mounted. Not all dmgs are mounted into a /Volumes location matching the name of the dmg. If not specified, this will use the name attribute.\n* `dmg_name` - Specify the name of the dmg if it is not the same as `app`, or if the name has spaces.\n\nUsage Examples\n==============\n\nInstall `/Applications/Tunnelblick.app` from the primary download site.\n\n dmg_package \"Tunnelblick\" do\n source \"http://tunnelblick.googlecode.com/files/Tunnelblick_3.1.2.dmg\"\n checksum \"a3fae60b6833175f32df20c90cd3a3603a\"\n action :install\n end\n\nInstall Google Chrome. Uses the `dmg_name` because the application name has spaces. Installs in `/Applications/Google Chrome.app`.\n\n dmg_package \"Google Chrome\" do\n dmg_name \"googlechrome\"\n source \"https://dl-ssl.google.com/chrome/mac/stable/GGRM/googlechrome.dmg\"\n checksum \"7daa2dc5c46d9bfb14f1d7ff4b33884325e5e63e694810adc58f14795165c91a\"\n action :install\n end\n\nInstall Dropbox. Uses `volumes_dir` because the mounted directory is different than the name of the application directory. Installs in `/Applications/Dropbox.app`.\n\n dmg_package \"Dropbox\" do\n volumes_dir \"Dropbox Installer\"\n source \"http://www.dropbox.com/download?plat=mac\"\n checksum \"b4ea620ca22b0517b75753283ceb82326aca8bc3c86212fbf725de6446a96a13\"\n action :install\n end\n\nInstall MacIrssi to `~/Applications` from the local file downloaded to the cache path into an Applications directory in the current user's home directory. Chef should run as a non-root user for this.\n\n directory \"#{ENV['HOME']}/Applications\"\n\n dmg_package \"MacIrssi\" do\n destination \"#{ENV['HOME']}/Applications\"\n action :install\n end\n\nInstall Virtualbox to `/Applications` from the .mpkg:\n\n dmg_package \"Virtualbox\" do\n source \"http://dlc.sun.com.edgesuite.net/virtualbox/4.0.8/VirtualBox-4.0.8-71778-OSX.dmg\"\n type \"mpkg\"\n end\n\nTo do\n=====\n\nA few things remain outstanding to make this cookbook \"1.0\" quality.\n\n* support downloading a .dmg.zip and unzipping it\n* specify a local .dmg already downloaded in another location (like ~/Downloads)\n\nSome things that would be nice to have at some point.\n\n* use hdiutil to mount/attach the disk image\n* automatically detect the `volumes_dir` where the image is attached\n* be able to automatically accept license agreements\n\nLicense and Author\n==================\n\n* Copyright 2011, Joshua Timberman <cookbooks@housepub.org>\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\n", | ||
"maintainer": "Joshua Timberman", | ||
"maintainer_email": "cookbooks@housepub.org", | ||
"license": "Apache 2.0", | ||
"platforms": { | ||
"mac_os_x": ">= 0.0.0" | ||
}, | ||
"dependencies": { | ||
}, | ||
"recommendations": { | ||
}, | ||
"suggestions": { | ||
}, | ||
"conflicting": { | ||
}, | ||
"providing": { | ||
}, | ||
"replacing": { | ||
}, | ||
"attributes": { | ||
}, | ||
"groupings": { | ||
}, | ||
"recipes": { | ||
}, | ||
"version": "0.6.0" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
maintainer "Joshua Timberman" | ||
maintainer_email "cookbooks@housepub.org" | ||
license "Apache 2.0" | ||
description "LWRP to install OS X applications from dmgs" | ||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) | ||
version "0.6.0" | ||
supports "mac_os_x" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# | ||
# Cookbook Name:: dmg | ||
# Provider:: package | ||
# | ||
# Copyright 2011, Joshua Timberman | ||
# | ||
# 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. | ||
# | ||
|
||
def load_current_resource | ||
@dmgpkg = Chef::Resource::DmgPackage.new(new_resource.name) | ||
@dmgpkg.app(new_resource.app) | ||
Chef::Log.debug("Checking for application #{new_resource.app}") | ||
installed = ::File.directory?("#{new_resource.destination}/#{new_resource.app}.app") | ||
@dmgpkg.installed(installed) | ||
end | ||
|
||
action :install do | ||
unless @dmgpkg.installed | ||
|
||
volumes_dir = new_resource.volumes_dir ? new_resource.volumes_dir : new_resource.app | ||
dmg_name = new_resource.dmg_name ? new_resource.dmg_name : new_resource.app | ||
dmg_file = "#{Chef::Config[:file_cache_path]}/#{dmg_name}.dmg" | ||
|
||
if new_resource.source | ||
remote_file dmg_file do | ||
source new_resource.source | ||
checksum new_resource.checksum if new_resource.checksum | ||
end | ||
end | ||
|
||
execute "hdid #{dmg_file}" do | ||
not_if "hdiutil info | grep -q 'image-path.*#{dmg_file}'" | ||
end | ||
|
||
case new_resource.type | ||
when "app" | ||
execute "cp -r '/Volumes/#{volumes_dir}/#{new_resource.app}.app' '#{new_resource.destination}'" | ||
when "mpkg" | ||
execute "sudo installer -pkg /Volumes/#{volumes_dir}/#{new_resource.app}.mpkg -target /" | ||
end | ||
|
||
execute "hdiutil detach '/Volumes/#{volumes_dir}'" | ||
|
||
file "#{new_resource.destination}/#{new_resource.app}.app/Contents/MacOS/#{new_resource.app}" do | ||
mode 0755 | ||
ignore_failure true | ||
end | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# | ||
# Cookbook Name:: dmg | ||
# Recipe:: default | ||
# | ||
# Copyright 2011, Joshua Timberman | ||
# | ||
# 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. | ||
# |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# | ||
# Cookbook Name:: dmg | ||
# Resource:: package | ||
# | ||
# Copyright 2011, Joshua Timberman | ||
# | ||
# 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. | ||
# | ||
actions :install | ||
|
||
attribute :app, :kind_of => String, :name_attribute => true | ||
attribute :source, :kind_of => String, :default => nil | ||
attribute :destination, :kind_of => String, :default => "/Applications" | ||
attribute :checksum, :kind_of => String, :default => nil | ||
attribute :volumes_dir, :kind_of => String, :default => nil | ||
attribute :dmg_name, :kind_of => String, :default => nil | ||
attribute :type, :kind_of => String, :default => "app" | ||
attribute :installed, :kind_of => [TrueClass, FalseClass], :default => false | ||
|
||
def initialize(name, run_context=nil) | ||
super | ||
@action = :install | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
case node[:platform] | ||
when 'mac_os_x' | ||
dmg_package "Firefox" do | ||
source 'http://mozilla.snt.utwente.nl/firefox/releases/5.0/mac/en-US/Firefox%205.0.dmg' | ||
action :install | ||
end | ||
|
||
else | ||
package 'firefox' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
base_url = "https://dl-ssl.google.com/linux/direct/" | ||
|
||
case node[:platform] | ||
when 'fedora', 'ubuntu' | ||
if node[:platform] == 'fedora' | ||
filename = "google-chrome-stable_current_i386.rpm" | ||
else | ||
filename = "google-chrome-stable_current_i386.deb" | ||
end | ||
|
||
bash "downloading package #{filename}" do | ||
cwd "/tmp" | ||
code "curl -kLsO #{base_url}#{filename}" | ||
not_if { File.exist? "/tmp/#{filename}" } | ||
end | ||
|
||
package 'google-chrome-stable' do | ||
source "/tmp/#{filename}" | ||
action :install | ||
end | ||
|
||
when 'mac_os_x' | ||
dmg_package "Google Chrome" do | ||
dmg_name "googlechrome" | ||
source "https://dl-ssl.google.com/chrome/mac/stable/GGRM/googlechrome.dmg" | ||
action :install | ||
end | ||
end |
Oops, something went wrong.