added $backports_enabled for including backports repository

This commit is contained in:
Varac 2009-12-10 11:00:00 +01:00
parent 802e591a25
commit c1694ae337
4 changed files with 76 additions and 51 deletions

3
README
View file

@ -1,3 +1,6 @@
forked from https://labs.riseup.net/code/projects/show/module-apt
Overview
========

View file

@ -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": }

View file

@ -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 -%>

View file

@ -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 -%>