From c1694ae3372352d975d5f49b4c2fd0e12e8e827e Mon Sep 17 00:00:00 2001 From: Varac Date: Thu, 10 Dec 2009 11:00:00 +0100 Subject: [PATCH] added $backports_enabled for including backports repository --- README | 3 + manifests/init.pp | 110 ++++++++++++++++----------- templates/sources.list.backports.erb | 8 ++ templates/sources.list.erb | 6 -- 4 files changed, 76 insertions(+), 51 deletions(-) create mode 100644 templates/sources.list.backports.erb diff --git a/README b/README index c6e6c4e..8299c02 100644 --- a/README +++ b/README @@ -1,3 +1,6 @@ +forked from https://labs.riseup.net/code/projects/show/module-apt + + Overview ======== diff --git a/manifests/init.pp b/manifests/init.pp index 96ab2db..1af6e1f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -11,6 +11,11 @@ class apt { default => $apt_clean, } + $backports_enabled = $backports_enabled ? { + '' => 'false', + default => $backports_enabled, + } + package { apt: ensure => installed } # a few templates need lsbdistcodename @@ -85,53 +90,68 @@ class apt { # Another Semaphor for all packages to reference alias => apt_updated; } - - ## This package should really always be current - package { "debian-archive-keyring": - ensure => latest, - } - - case $lsbdistcodename { - etch: { - package { "debian-backports-keyring": - ensure => latest, - } - - # This key was downloaded from - # http://backports.org/debian/archive.key - # and is needed to bootstrap the backports trustpath - file { "${apt_base_dir}/backports.org.key": - source => "puppet://$server/modules/apt/backports.org.key", - mode => 0444, owner => root, group => root, - } - exec { "/usr/bin/apt-key add ${apt_base_dir}/backports.org.key && apt-get update": - alias => "backports_key", - refreshonly => true, - subscribe => File["${apt_base_dir}/backports.org.key"], - before => [ File[apt_config], Package["debian-backports-keyring"] ] - } - } - lenny: { - package { "debian-backports-keyring": - ensure => latest, - } - - # This key was downloaded from - # http://backports.org/debian/archive.key - # and is needed to bootstrap the backports trustpath - file { "${apt_base_dir}/backports.org.key": - source => "puppet://$server/modules/apt/backports.org.key", - mode => 0444, owner => root, group => root, - } - exec { "/usr/bin/apt-key add ${apt_base_dir}/backports.org.key && apt-get update": - alias => "backports_key", - refreshonly => true, - subscribe => File["${apt_base_dir}/backports.org.key"], - before => [ File[apt_config], Package["debian-backports-keyring"] ] - } - } + + ## This package should really always be current + package { "debian-archive-keyring": + ensure => latest, } + case $backports_enabled { + 'true': { + config_file { + # backports + "/etc/apt/sources.list.d/debian-backports.list": + content => template("apt/sources.list.backports.erb"), + require => Exec[assert_lsbdistcodename]; + } + + case $lsbdistcodename { + etch: { + package { "debian-backports-keyring": + ensure => latest, + } + + # This key was downloaded from + # http://backports.org/debian/archive.key + # and is needed to bootstrap the backports trustpath + file { "${apt_base_dir}/backports.org.key": + source => "puppet://$server/modules/apt/backports.org.key", + mode => 0444, owner => root, group => root, + } + exec { "/usr/bin/apt-key add ${apt_base_dir}/backports.org.key && apt-get update": + alias => "backports_key", + refreshonly => true, + subscribe => File["${apt_base_dir}/backports.org.key"], + before => [ File[apt_config], Package["debian-backports-keyring"] ] + } + } + lenny: { + package { "debian-backports-keyring": + ensure => latest, + } + + # This key was downloaded from + # http://backports.org/debian/archive.key + # and is needed to bootstrap the backports trustpath + file { "${apt_base_dir}/backports.org.key": + source => "puppet://$server/modules/apt/backports.org.key", + mode => 0444, owner => root, group => root, + } + exec { "/usr/bin/apt-key add ${apt_base_dir}/backports.org.key && apt-get update": + alias => "backports_key", + refreshonly => true, + subscribe => File["${apt_base_dir}/backports.org.key"], + before => [ File[apt_config], Package["debian-backports-keyring"] ] + } + } + } + + } + default: { } + } + + + case $custom_key_dir { '': { exec { "/bin/true # no_custom_keydir": } diff --git a/templates/sources.list.backports.erb b/templates/sources.list.backports.erb new file mode 100644 index 0000000..b62f6d3 --- /dev/null +++ b/templates/sources.list.backports.erb @@ -0,0 +1,8 @@ +# This file is brought to you by puppet + +# backports +<% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable") -%> +# There are no backports for for <%= lsbdistcodename %> +<% else -%> +deb http://www.backports.org/debian/ <%= lsbdistcodename %>-backports main +<% end -%> diff --git a/templates/sources.list.erb b/templates/sources.list.erb index 169d7b5..feb5603 100644 --- a/templates/sources.list.erb +++ b/templates/sources.list.erb @@ -9,9 +9,3 @@ deb http://ftp.debian.org/debian/ <%= lsbdistcodename %> main contrib non-free deb http://security.debian.org/ <%= lsbdistcodename %>/updates main contrib non-free <% end -%> -# backports -<% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable") -%> -# There are no backports for for <%= lsbdistcodename %> -<% else -%> -deb http://www.backports.org/debian/ <%= lsbdistcodename %>-backports main -<% end -%>