Permalink
Browse files

add ucspi-tcp cookbook for daemontools

  • Loading branch information...
1 parent b9b3867 commit c55e17d188899dd8aaab098f42c0d648366210ec @jtimberman jtimberman committed Nov 14, 2010
Showing with 195 additions and 0 deletions.
  1. +35 −0 ucspi-tcp/README.md
  2. +37 −0 ucspi-tcp/attributes/default.rb
  3. +48 −0 ucspi-tcp/metadata.json
  4. +16 −0 ucspi-tcp/metadata.rb
  5. +59 −0 ucspi-tcp/recipes/default.rb
View
@@ -0,0 +1,35 @@
+Description
+===========
+
+Installs DJB's ucspi-tcp software.
+
+Requirements
+============
+
+Should work on ArchLinux, Debian and Ubuntu. Source installation may work on Red Hat family distributions.
+
+Requires build-essential cookbook.
+
+Usage
+=====
+
+Include the ucspi-tcp recipe in the run list. The recipe will automatically detect the platform and attempt to install based on what should be available.
+
+License and Author
+==================
+
+Author: Joshua Timberman (<joshua@opscode.com>)
+
+Copyright 2010, Opscode, 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.
@@ -0,0 +1,37 @@
+#
+# Cookbook Name:: ucspi-tcp
+# Attribute:: default
+#
+# Copyright 2010, Opscode, 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.
+#
+
+case platform
+when "ubuntu"
+ if platform_version.to_f >= 9.04
+ set[:ucspi][:bin_dir] = "/usr/bin"
+ else
+ set[:ucspi][:bin_dir] = "/usr/local/bin"
+ end
+when "debian"
+ if platform_version.to_f >= 5.0
+ set[:ucspi][:bin_dir] = "/usr/bin"
+ else
+ set[:ucspi][:bin_dir] = "/usr/local/bin"
+ end
+when "arch"
+ set[:ucspi][:bin_dir] = "/usr/bin"
+else
+ set[:ucspi][:bin_dir] = "/usr/local/bin"
+end
View
@@ -0,0 +1,48 @@
+{
+ "name": "ucspi-tcp",
+ "description": "Installs ucspi-tcp",
+ "long_description": "Description\n===========\n\nInstalls DJB's ucspi-tcp software.\n\nRequirements\n============\n\nShould work on ArchLinux, Debian and Ubuntu. Source installation may work on Red Hat family distributions.\n\nRequires build-essential cookbook.\n\nUsage\n=====\n\nInclude the ucspi-tcp recipe in the run list. The recipe will automatically detect the platform and attempt to install based on what should be available.\n\nLicense and Author\n==================\n\nAuthor: Joshua Timberman (<joshua@opscode.com>)\n\nCopyright 2010, Opscode, Inc.\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\nlimitations under the License.\n",
+ "maintainer": "Opscode, Inc.",
+ "maintainer_email": "cookbooks@opscode.com",
+ "license": "Apache 2.0",
+ "platforms": {
+ "ubuntu": [
+
+ ],
+ "debian": [
+
+ ],
+ "centos": [
+
+ ],
+ "rhel": [
+
+ ],
+ "arch": [
+
+ ]
+ },
+ "dependencies": {
+ "build-essential": [
+
+ ]
+ },
+ "recommendations": {
+ },
+ "suggestions": {
+ },
+ "conflicting": {
+ },
+ "providing": {
+ },
+ "replacing": {
+ },
+ "attributes": {
+ },
+ "groupings": {
+ },
+ "recipes": {
+ "ucspi-tcp": "Installs ucspi-tcp"
+ },
+ "version": "1.0.0"
+}
View
@@ -0,0 +1,16 @@
+maintainer "Opscode, Inc."
+maintainer_email "cookbooks@opscode.com"
+license "Apache 2.0"
+description "Installs ucspi-tcp"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version "1.0.0"
+
+recipe "ucspi-tcp", "Installs ucspi-tcp"
+
+%w{ build-essential }.each do |cb|
+ depends cb
+end
+
+%w{ ubuntu debian centos rhel arch }.each do |os|
+ supports os
+end
@@ -0,0 +1,59 @@
+#
+# Cookbook Name:: ucspi-tcp
+# Recipe:: default
+#
+# Copyright 2010, Opscode, 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.
+#
+
+include_recipe "build-essential"
+
+installation_method = value_for_platform(
+ "arch" => { "default" => "aur" },
+ "debian" => { "4.0" => "source", "default" => "package" },
+ "ubuntu" => {
+ "6.06" => "source",
+ "6.10" => "source",
+ "7.04" => "source",
+ "7.10" => "source",
+ "8.04" => "source",
+ "default" => "package"
+ },
+ "default" => { "default" => "source" }
+)
+
+case installation_method
+when "package"
+ package "ucspi-tcp" do
+ action :install
+ end
+when "aur"
+ pacman_aur "ucspi-tcp" do
+ action [:build,:install]
+ end
+when "source"
+ bash "install_ucspi" do
+ user "root"
+ cwd "/tmp"
+ code <<-EOH
+ (cd /tmp; wget http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz)
+ (cd /tmp; tar zxvf ucspi-tcp-0.88.tar.gz)
+ (cd /tmp/ucspi-tcp-0.88; perl -pi -e 's/extern int errno;/\#include <errno.h>/' error.h)
+ (cd /tmp/ucspi-tcp-0.88; make setup check)
+ EOH
+ not_if { ::File.exists?("#{node[:ucspi][:bin_dir]}/tcpserver") }
+ end
+else
+ Chef::Log.info("Could not find an installation method for platform #{node[:platform]}, version #{node[:platform_version]}")
+end

0 comments on commit c55e17d

Please sign in to comment.