2007-06-25 11:50:19 +02:00
|
|
|
# apt.pp - common components and defaults for handling apt
|
2008-09-29 22:27:18 +02:00
|
|
|
# Copyright (C) 2008 Micah Anerson <micah@riseup.net>
|
2007-06-25 11:50:19 +02:00
|
|
|
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
|
|
|
|
# See LICENSE for the full license granted to you.
|
|
|
|
|
|
|
|
class apt {
|
|
|
|
|
2009-10-30 18:21:42 +01:00
|
|
|
# See README
|
|
|
|
$real_apt_clean = $apt_clean ? {
|
|
|
|
'' => 'auto',
|
|
|
|
default => $apt_clean,
|
|
|
|
}
|
|
|
|
|
2009-10-30 22:19:07 +01:00
|
|
|
package { apt:
|
|
|
|
ensure => installed,
|
|
|
|
require => undef,
|
|
|
|
}
|
2009-10-30 18:21:42 +01:00
|
|
|
|
|
|
|
case $custom_sources_list {
|
|
|
|
'': {
|
|
|
|
include apt::default_sources_list
|
|
|
|
}
|
|
|
|
default: {
|
2009-10-30 22:04:48 +01:00
|
|
|
include lsb
|
2009-10-30 18:21:42 +01:00
|
|
|
config_file { "/etc/apt/sources.list":
|
|
|
|
content => $custom_sources_list,
|
2009-10-30 22:19:07 +01:00
|
|
|
require => Package['lsb'];
|
2009-10-30 18:21:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-17 13:58:59 +02:00
|
|
|
include apt::preferences
|
2007-06-25 11:50:19 +02:00
|
|
|
|
2009-10-30 20:35:30 +01:00
|
|
|
if $apt_unattended_upgrades {
|
|
|
|
include apt::unattended_upgrades
|
|
|
|
}
|
|
|
|
|
2010-05-09 22:44:40 +02:00
|
|
|
include common::moduledir
|
|
|
|
$apt_base_dir = "${common::moduledir::module_dir_path}/apt"
|
2009-10-30 21:43:43 +01:00
|
|
|
modules_dir { apt: }
|
2009-10-30 18:21:42 +01:00
|
|
|
# watch apt.conf.d
|
|
|
|
file { "/etc/apt/apt.conf.d": ensure => directory, checksum => mtime; }
|
|
|
|
|
|
|
|
exec {
|
|
|
|
# "&& sleep 1" is workaround for older(?) clients
|
2010-08-10 16:27:54 +02:00
|
|
|
'refresh_apt':
|
|
|
|
command => '/usr/bin/apt-get update && sleep 1',
|
2009-10-30 18:21:42 +01:00
|
|
|
refreshonly => true,
|
2010-10-17 15:18:08 +02:00
|
|
|
subscribe => File['/etc/apt/sources.list',
|
|
|
|
'/etc/apt/apt.conf.d',
|
|
|
|
'/etc/apt/preferences'];
|
2010-08-10 16:27:54 +02:00
|
|
|
'update_apt':
|
|
|
|
command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean',
|
2010-10-17 15:18:08 +02:00
|
|
|
require => File['/etc/apt/sources.list',
|
|
|
|
'/etc/apt/preferences'],
|
2010-06-28 21:49:09 +02:00
|
|
|
loglevel => info,
|
2009-10-30 18:21:42 +01:00
|
|
|
# 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":
|
2010-08-07 02:12:12 +02:00
|
|
|
source => "puppet:///modules/apt/backports.org.key",
|
2009-10-30 18:21:42 +01:00
|
|
|
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"],
|
2010-10-17 13:58:59 +02:00
|
|
|
before => [ Concatenated_file[apt_config], Package["debian-backports-keyring"] ]
|
2009-10-30 18:21:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
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":
|
2010-08-07 02:12:12 +02:00
|
|
|
source => "puppet:///modules/apt/backports.org.key",
|
2009-10-30 18:21:42 +01:00
|
|
|
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"],
|
2010-10-17 13:58:59 +02:00
|
|
|
before => [ Concatenated_file[apt_config], Package["debian-backports-keyring"] ]
|
2009-10-30 18:21:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-15 22:31:42 +02:00
|
|
|
if $custom_key_dir {
|
|
|
|
file { "${apt_base_dir}/keys.d":
|
|
|
|
source => "$custom_key_dir",
|
|
|
|
recurse => true,
|
|
|
|
mode => 0755, owner => root, group => root,
|
2009-10-30 18:21:42 +01:00
|
|
|
}
|
2010-09-15 22:31:42 +02:00
|
|
|
exec { "find ${apt_base_dir}/keys.d -type f -exec apt-key add '{}' \\; && apt-get update":
|
|
|
|
alias => "custom_keys",
|
|
|
|
subscribe => File["${apt_base_dir}/keys.d"],
|
|
|
|
refreshonly => true,
|
2010-10-17 13:58:59 +02:00
|
|
|
before => Concatenated_file[apt_config];
|
2009-10-30 18:21:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# workaround for preseeded_package component
|
2010-09-15 22:31:42 +02:00
|
|
|
file { [ "/var/cache", "/var/cache/local", "/var/cache/local/preseeding" ]: ensure => directory }
|
2009-10-30 18:21:42 +01:00
|
|
|
}
|