Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 380c8fe
Showing
8 changed files
with
218 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,79 @@ | ||
Description | ||
=========== | ||
|
||
This cookbook provides an easy way to install PulseAudio. | ||
|
||
More information? | ||
http://www.freedesktop.org/wiki/Software/PulseAudio/ | ||
|
||
Requirements | ||
============ | ||
|
||
## Cookbooks: | ||
|
||
* build-essential | ||
* git | ||
|
||
## Platforms: | ||
|
||
* Debian | ||
* Ubuntu | ||
* CentOS | ||
* RHEL | ||
* Fedora | ||
* Scientific | ||
* Amazon | ||
|
||
Attributes | ||
========== | ||
|
||
* `node['pulseaudio']['install_method']` - Installation method, ':source' or ':package' - default ':package' | ||
* `node['pulseaudio']['prefix']` - Location prefix of where the installation files will go if installing via ':source' | ||
* `node['pulseaudio']['git_repository']` - Location of the source git repository | ||
* `node['pulseaudio']['git_revision']` - Revision of the git repository to install | ||
* `node['pulseaudio']['compile_flags']` - Array of flags to use in compilation process | ||
|
||
Usage | ||
===== | ||
|
||
1) include `recipe[pulseaudio]` in a run list | ||
2) tweak the attributes via attributes/default.rb | ||
--- OR --- | ||
override the attribute on a higher level (http://wiki.opscode.com/display/chef/Attributes#Attributes-AttributesPrecedence) | ||
|
||
References | ||
========== | ||
|
||
* [PulseAudio home page] (http://www.freedesktop.org/wiki/Software/PulseAudio/) | ||
|
||
License and Authors | ||
=================== | ||
|
||
Author: Dave Perrett <hello@daveperrett.com> | ||
Copyright: 2014, Dave Perrett | ||
|
||
Based heavily on the [yasm cookbook](https://github.com/escapestudios-cookbooks/yasm) by Escape Studios. | ||
Author: David Joos <david@escapestudios.com> | ||
Author: Escape Studios Development <dev@escapestudios.com> | ||
Copyright: 2012-2013, Escape Studios | ||
|
||
Unless otherwise noted, all files are released under the MIT license, | ||
possible exceptions will contain licensing information in them. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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,13 @@ | ||
# | ||
# Cookbook Name:: pulseaudio | ||
# Attributes:: default | ||
# | ||
# Copyright 2014, Dave Perrett | ||
# | ||
# Based on https://github.com/escapestudios-cookbooks/yasm | ||
|
||
default[:pulseaudio][:install_method] = :package | ||
default[:pulseaudio][:prefix] = "/usr/local" | ||
default[:pulseaudio][:git_repository] = "git://anongit.freedesktop.org/pulseaudio/pulseaudio" | ||
default[:pulseaudio][:git_revision] = "HEAD" | ||
default[:pulseaudio][:compile_flags] = [] |
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,24 @@ | ||
# | ||
# Cookbook Name:: pulseaudio | ||
# Library:: helpers | ||
# | ||
# Copyright 2014, Dave Perrett | ||
# | ||
# Based on https://github.com/escapestudios-cookbooks/yasm | ||
|
||
module PulseAudio | ||
module Helpers | ||
# Returns an array of package names that will install pulseaudio on a node. | ||
# Package names returned are determined by the platform running this recipe. | ||
def pulseaudio_packages | ||
value_for_platform( | ||
[ "ubuntu" ] => { "default" => [ "pulseaudio" ] }, | ||
"default" => [ "pulseaudio" ] | ||
) | ||
end | ||
end | ||
end | ||
|
||
class Chef::Recipe | ||
include PulseAudio::Helpers | ||
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 @@ | ||
name "pulseaudio" | ||
maintainer "Dave Perrett" | ||
maintainer_email "hello@daveperrett.com" | ||
license "MIT" | ||
description "Installs/Configures PulseAudio" | ||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) | ||
version "0.0.1" | ||
|
||
%w{ debian ubuntu centos redhat fedora scientific amazon }.each do |os| | ||
supports os | ||
end | ||
|
||
depends "build-essential" | ||
depends "git" | ||
|
||
recipe "pulseaudio", "Installs PulseAudio." | ||
recipe "pulseaudio::package", "Installs PulseAudio using packages." | ||
recipe "pulseaudio::source", "Installs PulseAudio from source." |
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,14 @@ | ||
# | ||
# Cookbook Name:: pulseaudio | ||
# Recipe:: default | ||
# | ||
# Copyright 2014, Dave Perrett | ||
# | ||
# Based on https://github.com/escapestudios-cookbooks/yasm | ||
|
||
case node[:pulseaudio][:install_method] | ||
when :source | ||
include_recipe "pulseaudio::source" | ||
when :package | ||
include_recipe "pulseaudio::package" | ||
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,13 @@ | ||
# | ||
# Cookbook Name:: pulseaudio | ||
# Recipe:: package | ||
# | ||
# Copyright 2014, Dave Perrett | ||
# | ||
# Based on https://github.com/escapestudios-cookbooks/yasm | ||
|
||
pulseaudio_packages.each do |pkg| | ||
package pkg do | ||
action :upgrade | ||
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,52 @@ | ||
# | ||
# Cookbook Name:: pulseaudio | ||
# Recipe:: source | ||
# | ||
# Copyright 2014, Dave Perrett | ||
# | ||
# Based on https://github.com/escapestudios-cookbooks/yasm | ||
|
||
include_recipe "build-essential" | ||
include_recipe "git" | ||
|
||
pulseaudio_packages.each do |pkg| | ||
package pkg do | ||
action :purge | ||
end | ||
end | ||
|
||
creates_pulseaudio = "#{node[:pulseaudio][:prefix]}/bin/pulseaudio" | ||
|
||
file "#{creates_pulseaudio}" do | ||
action :nothing | ||
end | ||
|
||
git "#{Chef::Config[:file_cache_path]}/pulseaudio" do | ||
repository node[:pulseaudio][:git_repository] | ||
reference node[:pulseaudio][:git_revision] | ||
action :sync | ||
notifies :delete, resources(:file => creates_pulseaudio), :immediately | ||
end | ||
|
||
#write the flags used to compile to disk | ||
template "#{Chef::Config[:file_cache_path]}/pulseaudio-compiled_with_flags" do | ||
source "compiled_with_flags.erb" | ||
owner "root" | ||
group "root" | ||
mode 0600 | ||
variables( | ||
:compile_flags => node[:pulseaudio][:compile_flags] | ||
) | ||
notifies :delete, resources(:file => creates_pulseaudio), :immediately | ||
end | ||
|
||
bash "compile_pulseaudio" do | ||
cwd "#{Chef::Config[:file_cache_path]}/pulseaudio" | ||
code <<-EOH | ||
autoreconf | ||
automake --add-missing | ||
./configure --prefix=#{node[:pulseaudio][:prefix]} #{node[:pulseaudio][:compile_flags].join(' ')} | ||
make clean && make && make install | ||
EOH | ||
creates "#{creates_pulseaudio}" | ||
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,5 @@ | ||
# Generated automatically by Chef | ||
# Removing or modifying this file will cause HTTP-live-stream-segmenter to recompile during the next Chef run. | ||
<% @compile_flags.each do |flag| %> | ||
<%= flag %> | ||
<% end %> |