Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions cookbooks/firefox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Firefox versions
=========

####Compatible with Linux Gentoo.
Downloads firefox zip files in home directory, extracts them and sym links files.

Attributes
----
In attributes/default.rb file add the firefox versions you want to extract from [firefox ftp url]. Add the sha1 checksum in the file.

Recipes
----
Default recipe downloads the default firefox version and other firefox versions mentioned in the default attributes file, them symlinks them with /usr/bin/firefox#{version}. The default version is also symlinked with /usr/bin/firefox.

[firefox ftp url]:http://ftp.mozilla.org/pub/mozilla.org/firefox/releases
16 changes: 16 additions & 0 deletions cookbooks/firefox/attributes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
default[:firefox]["28"] = {
:url => "http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/linux-x86_64/en-US/firefox-28.0.tar.bz2",
:filename => "firefox-28.0.tar.bz2",
:sha => "c032902b548a6e22a5ec74fda376ca76",
:firefox_dir => 'firefox'
}

default[:firefox]["32"] = {
:url => "http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0/linux-x86_64/en-US/firefox-32.0.tar.bz2",
:filename => "firefox-32.0.tar.bz2",
:sha => "53410cf0944d4d7136130e03cf1b58b7dc181007",
:firefox_dir => 'firefox'
}

default[:firefox][:default_version] = "28"
default[:firefox][:other_versions] = ["32"]
69 changes: 69 additions & 0 deletions cookbooks/firefox/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#
# Cookbook Name:: firefox
# Recipe:: default
#

if ['app_master', 'app', 'solo', 'util'].include?(node[:instance_role])

# firefox-bin packages are required to run firefox
package "www-client/firefox-bin"
package "www-client/firefox-bin" do
action :upgrade
end

dir_path = "/home/firefoxes"
user = node[:owner_name]

directory dir_path do
owner user
mode "0755"
action :create
end

# all the firefox versions which needs to be downloaded and extracted
firefox_default_version = node[:firefox][:default_version]
# all the firefox versions which need to be downloaded and installed
node[:firefox][:versions] = [firefox_default_version] | node[:firefox][:other_versions]
node[:firefox][:versions].each do |firefox_version|
directory "#{dir_path}/#{firefox_version}" do
owner user
mode "0755"
action :create
end

firefox = node[:firefox][firefox_version]
firefox_version_path = "#{dir_path}/#{firefox_version}"
tar_file = "#{firefox_version_path}/#{firefox[:filename]}"

remote_file tar_file do
owner user
source firefox[:url]
checksum firefox[:sha]
action :create_if_missing
end

bash "untar firefox-#{firefox_version} to #{dir_path}" do
cwd firefox_version_path
code <<-EOH
tar jxf #{tar_file}
EOH
end

link "/usr/bin/firefox#{firefox_version}" do
to"#{firefox_version_path}/#{firefox[:firefox_dir]}/firefox"
end

link "/usr/bin/firefox-bin#{firefox_version}" do
to"#{firefox_version_path}/#{firefox[:firefox_dir]}/firefox-bin"
end
end

# the default firefox version is sym linked
link "/usr/bin/firefox" do
to"/usr/bin/firefox#{firefox_default_version}"
end

link "/usr/bin/firefox-bin" do
to"/usr/bin/firefox-bin#{firefox_default_version}"
end
end
3 changes: 3 additions & 0 deletions cookbooks/main/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,6 @@
# postgresql9_pg_buffercache "postgres"
# postgresql9_pg_freespacemap "postgres"
# end
#
#uncomment to include the firefox recipe
#include_recipe "firefox"