Skip to content
Browse files

support for Debian 6

  • Loading branch information...
1 parent 754763e commit ebdb88b76c600711c82eceeec2f9e5a020ee8165 @phlipper committed Dec 26, 2012
Showing with 55 additions and 7 deletions.
  1. +1 −0 README.md
  2. +3 −0 files/default/pgdg.pref
  3. +5 −1 metadata.rb
  4. +46 −6 recipes/default.rb
View
1 README.md
@@ -21,6 +21,7 @@ The default version is `9.1`.
The following platforms are supported by this cookbook, meaning that the recipes run on these platforms without error:
* Ubuntu
+* Debian 6
## Recipes
View
3 files/default/pgdg.pref
@@ -0,0 +1,3 @@
+Package: *
+Pin: release o=apt.postgresql.org
+Pin-Priority: 500
View
6 metadata.rb
@@ -15,4 +15,8 @@
recipe "postgresql::libpq", "PostgreSQL C client library and header files for libpq5 (PostgreSQL library)"
recipe "postgresql::postgis", "Geographic objects support for PostgreSQL 9.x"
-supports "ubuntu"
+%w[ubuntu debian].each do |os|
+ supports os
+end
+
+depends "apt"
View
52 recipes/default.rb
@@ -3,11 +3,51 @@
# Recipe:: default
#
-package "python-software-properties"
+case node["lsb"]["id"]
+when "Ubuntu"
-execute "setup ppa apt repository" do
- command "add-apt-repository ppa:pitti/postgresql && apt-get update"
- not_if "test -f /etc/apt/sources.list.d/pitti-postgresql-#{node["lsb"]["codename"]}.list"
-end
+ apt_repository "pitti-postgresql" do
+ uri "http://ppa.launchpad.net/pitti/postgresql/ubuntu"
+ distribution node["lsb"]["codename"]
+ components ["main"]
+ keyserver "keyserver.ubuntu.com"
+ key "8683D8A2"
+ action :add
+ notifies :run, "execute[apt-get update]", :immediately
+ end
+
+ # install common files
+ package "postgresql-common"
+
+when "Debian"
+
+ # backports for initial support
+ apt_repository "debian-backports" do
+ uri "http://backports.debian.org/debian-backports"
+ distribution "#{node["lsb"]["codename"]}-backports"
+ components ["main"]
+ action :add
+ notifies :run, "execute[apt-get update]", :immediately
+ end
-package "postgresql-common"
+ cookbook_file "/etc/apt/preferences.d/pgdg.pref" do
+ source "pgdg.pref"
+ end
+
+ # backports support for debian
+ %w[libpq5 postgresql-common].each do |pkg|
+ package pkg do
+ options "-t #{node["lsb"]["codename"]}-backports"
+ end
+ end
+
+ # use `apt.postgresql.org` for primary package installation support
+ apt_repository "apt.postgresql.org" do
+ uri "http://apt.postgresql.org/pub/repos/apt"
+ distribution "#{node["lsb"]["codename"]}-pgdg"
+ components ["main"]
+ key "http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc"
+ action :add
+ notifies :run, "execute[apt-get update]", :immediately
+ end
+end

0 comments on commit ebdb88b

Please sign in to comment.
Something went wrong with that request. Please try again.