Add apt cookbook
authorTom Hughes <tom@compton.nu>
Thu, 30 May 2013 20:24:04 +0000 (21:24 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 30 May 2013 20:24:04 +0000 (21:24 +0100)
cookbooks/apt/apt/README.rdoc [new file with mode: 0644]
cookbooks/apt/apt/attributes/default.rb [new file with mode: 0644]
cookbooks/apt/apt/definitions/apt_source.rb [new file with mode: 0644]
cookbooks/apt/apt/metadata.rb [new file with mode: 0644]
cookbooks/apt/apt/recipes/default.rb [new file with mode: 0644]
cookbooks/apt/apt/templates/default/default.list.erb [new file with mode: 0644]
cookbooks/apt/apt/templates/default/hp.list.erb [new file with mode: 0644]
cookbooks/apt/apt/templates/default/opscode.list.erb [new file with mode: 0644]
cookbooks/apt/apt/templates/default/sources.list.erb [new file with mode: 0644]

diff --git a/cookbooks/apt/apt/README.rdoc b/cookbooks/apt/apt/README.rdoc
new file mode 100644 (file)
index 0000000..3de2ec7
--- /dev/null
@@ -0,0 +1,8 @@
+= DESCRIPTION:
+
+= REQUIREMENTS:
+
+= ATTRIBUTES:
+
+= USAGE:
+
diff --git a/cookbooks/apt/apt/attributes/default.rb b/cookbooks/apt/apt/attributes/default.rb
new file mode 100644 (file)
index 0000000..2ecdb20
--- /dev/null
@@ -0,0 +1 @@
+default[:apt][:sources] ||= []
diff --git a/cookbooks/apt/apt/definitions/apt_source.rb b/cookbooks/apt/apt/definitions/apt_source.rb
new file mode 100644 (file)
index 0000000..c109707
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Cookbook Name:: apt
+# Definition:: apt_source
+#
+# Copyright 2010, Tom Hughes
+#
+# 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.
+#
+
+define :apt_source do
+  if node.apt.sources.include?(params[:name])
+    source_action = :create
+
+    execute "apt-key-#{params[:key]}" do
+      command "/usr/bin/apt-key adv --keyserver hkp://keys.gnupg.net --recv-keys #{params[:key]}"
+      not_if "/usr/bin/apt-key list | /bin/fgrep -q #{params[:key]}"
+    end
+  else
+    source_action = :delete
+  end
+
+  template "/etc/apt/sources.list.d/#{params[:name]}.list" do
+    action source_action
+    source params[:template] || "default.list.erb"
+    owner "root"
+    group "root"
+    mode 0644
+    notifies :run, resources(:execute => "apt-update")
+    variables :url => params[:url]
+  end
+end
diff --git a/cookbooks/apt/apt/metadata.rb b/cookbooks/apt/apt/metadata.rb
new file mode 100644 (file)
index 0000000..5242ffa
--- /dev/null
@@ -0,0 +1,9 @@
+maintainer       "Tom Hughes"
+maintainer_email "tom@compton.nu"
+license          "Apache 2.0"
+description      "Installs/Configures apt"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version          "0.1"
+supports         "debian"
+supports         "ubuntu"
+recipe           "apt", "Installs and configures apt"
diff --git a/cookbooks/apt/apt/recipes/default.rb b/cookbooks/apt/apt/recipes/default.rb
new file mode 100644 (file)
index 0000000..4b5fdf7
--- /dev/null
@@ -0,0 +1,106 @@
+#
+# Cookbook Name:: apt
+# Recipe:: default
+#
+# Copyright 2010, Tom Hughes
+#
+# 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.
+#
+
+package "apt"
+package "update-notifier-common"
+
+file "/etc/motd.tail" do
+  action :delete
+end
+
+execute "apt-update" do
+  action :nothing
+  command "/usr/bin/apt-get update"
+end
+
+template "/etc/apt/sources.list" do
+  source "sources.list.erb"
+  owner "root"
+  group "root"
+  mode 0644
+  notifies :run, resources(:execute => "apt-update")
+end
+
+apt_source "opscode" do
+  template "opscode.list.erb"
+  url "http://apt.opscode.com/"
+  key "83EF826A"
+end
+
+apt_source "brightbox" do
+  url "http://apt.brightbox.net/"
+  key "0090DAAD"
+end
+
+apt_source "brightbox-ruby-ng" do
+  url "http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu"
+  key "C3173AA6"
+end
+
+apt_source "brightbox-ruby-ng-experimental" do
+  url "http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu-experimental"
+  key "C3173AA6"
+end
+
+apt_source "pitti-postgresql" do
+  url "http://ppa.launchpad.net/pitti/postgresql/ubuntu"
+  key "8683D8A2"
+end
+
+apt_source "ubuntugis-stable" do
+  url "http://ppa.launchpad.net/ubuntugis/ppa/ubuntu"
+  key "314DF160"
+end
+
+apt_source "ubuntugis-unstable" do
+  url "http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu"
+  key "314DF160"
+end
+
+apt_source "brianmercer-php" do
+  url "http://ppa.launchpad.net/brianmercer/php/ubuntu"
+  key "8D0DC64F"
+end
+
+apt_source "aw-drupal" do
+  url "http://ppa.launchpad.net/aw/drupal/ubuntu"
+  key "7D5AE8F6"
+end
+
+apt_source "openstreetmap" do
+  url "http://ppa.launchpad.net/osmadmins/ppa/ubuntu"
+  key "0AC4F2CB"
+end
+
+apt_source "proliant-support-pack" do
+  template "hp.list.erb"
+  url "http://downloads.linux.hp.com/SDR/downloads/ProLiantSupportPack"
+  key "2689B887"
+end
+
+apt_source "management-component-pack" do
+  template "hp.list.erb"
+  url "http://downloads.linux.hp.com/SDR/downloads/ManagementComponentPack"
+  key "2689B887"
+end
+
+apt_source "mapnik-v210" do
+  url "http://ppa.launchpad.net/mapnik/v2.1.0/ubuntu"
+  key "5D50B6BA"
+end
diff --git a/cookbooks/apt/apt/templates/default/default.list.erb b/cookbooks/apt/apt/templates/default/default.list.erb
new file mode 100644 (file)
index 0000000..d546aba
--- /dev/null
@@ -0,0 +1,4 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+deb <%= @url %> <%= node.lsb.codename %> main
+deb-src <%= @url %> <%= node.lsb.codename %> main
diff --git a/cookbooks/apt/apt/templates/default/hp.list.erb b/cookbooks/apt/apt/templates/default/hp.list.erb
new file mode 100644 (file)
index 0000000..49449dd
--- /dev/null
@@ -0,0 +1,3 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+deb <%= @url %> <%= node.lsb.codename %>/current non-free
diff --git a/cookbooks/apt/apt/templates/default/opscode.list.erb b/cookbooks/apt/apt/templates/default/opscode.list.erb
new file mode 100644 (file)
index 0000000..1b3ceb7
--- /dev/null
@@ -0,0 +1,4 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+deb <%= @url %> <%= node.lsb.codename %>-0.10 main
+deb-src <%= @url %> <%= node.lsb.codename %>-0.10 main
diff --git a/cookbooks/apt/apt/templates/default/sources.list.erb b/cookbooks/apt/apt/templates/default/sources.list.erb
new file mode 100644 (file)
index 0000000..c6cdff5
--- /dev/null
@@ -0,0 +1,51 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+deb http://<%= node.country %>.archive.ubuntu.com/ubuntu/ <%= node.lsb.codename %> main restricted
+deb-src http://<%= node.country %>.archive.ubuntu.com/ubuntu/ <%= node.lsb.codename %> main restricted
+
+## Major bug fix updates produced after the final release of the
+## distribution.
+deb http://<%= node.country %>.archive.ubuntu.com/ubuntu/ <%= node.lsb.codename %>-updates main restricted
+deb-src http://<%= node.country %>.archive.ubuntu.com/ubuntu/ <%= node.lsb.codename %>-updates main restricted
+
+## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
+## team. Also, please note that software in universe WILL NOT receive any
+## review or updates from the Ubuntu security team.
+deb http://<%= node.country %>.archive.ubuntu.com/ubuntu/ <%= node.lsb.codename %> universe
+deb-src http://<%= node.country %>.archive.ubuntu.com/ubuntu/ <%= node.lsb.codename %> universe
+deb http://<%= node.country %>.archive.ubuntu.com/ubuntu/ <%= node.lsb.codename %>-updates universe
+deb-src http://<%= node.country %>.archive.ubuntu.com/ubuntu/ <%= node.lsb.codename %>-updates universe
+
+## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
+## team, and may not be under a free licence. Please satisfy yourself as to 
+## your rights to use the software. Also, please note that software in 
+## multiverse WILL NOT receive any review or updates from the Ubuntu
+## security team.
+deb http://<%= node.country %>.archive.ubuntu.com/ubuntu/ <%= node.lsb.codename %> multiverse
+deb-src http://<%= node.country %>.archive.ubuntu.com/ubuntu/ <%= node.lsb.codename %> multiverse
+deb http://<%= node.country %>.archive.ubuntu.com/ubuntu/ <%= node.lsb.codename %>-updates multiverse
+deb-src http://<%= node.country %>.archive.ubuntu.com/ubuntu/ <%= node.lsb.codename %>-updates multiverse
+
+## Uncomment the following two lines to add software from the 'backports'
+## repository.
+## N.B. software from this repository may not have been tested as
+## extensively as that contained in the main release, although it includes
+## newer versions of some applications which may provide useful features.
+## Also, please note that software in backports WILL NOT receive any review
+## or updates from the Ubuntu security team.
+deb http://<%= node.country %>.archive.ubuntu.com/ubuntu/ <%= node.lsb.codename %>-backports main restricted universe multiverse
+deb-src http://<%= node.country %>.archive.ubuntu.com/ubuntu/ <%= node.lsb.codename %>-backports main restricted universe multiverse
+
+## Uncomment the following two lines to add software from Canonical's
+## 'partner' repository. This software is not part of Ubuntu, but is
+## offered by Canonical and the respective vendors as a service to Ubuntu
+## users.
+# deb http://archive.canonical.com/ubuntu <%= node.lsb.codename %> partner
+# deb-src http://archive.canonical.com/ubuntu <%= node.lsb.codename %> partner
+
+deb http://security.ubuntu.com/ubuntu <%= node.lsb.codename %>-security main restricted
+deb-src http://security.ubuntu.com/ubuntu <%= node.lsb.codename %>-security main restricted
+deb http://security.ubuntu.com/ubuntu <%= node.lsb.codename %>-security universe
+deb-src http://security.ubuntu.com/ubuntu <%= node.lsb.codename %>-security universe
+deb http://security.ubuntu.com/ubuntu <%= node.lsb.codename %>-security multiverse
+deb-src http://security.ubuntu.com/ubuntu <%= node.lsb.codename %>-security multiverse