2010-04-27 22:38:28 +02:00
|
|
|
# source.pp
|
|
|
|
# add an apt source
|
|
|
|
|
|
|
|
define apt::source(
|
2011-05-30 19:24:06 +02:00
|
|
|
$location = '',
|
|
|
|
$release = 'karmic',
|
|
|
|
$repos = 'main',
|
|
|
|
$include_src = true,
|
|
|
|
$required_packages = false,
|
|
|
|
$key = false,
|
|
|
|
$key_server = 'keyserver.ubuntu.com',
|
2011-06-03 09:20:00 +02:00
|
|
|
$pin = false,
|
|
|
|
$key_content = false
|
2010-04-27 22:38:28 +02:00
|
|
|
) {
|
|
|
|
|
2011-05-30 19:18:13 +02:00
|
|
|
include apt::params
|
2010-04-27 22:38:28 +02:00
|
|
|
|
2011-05-30 19:24:06 +02:00
|
|
|
file { "${name}.list":
|
2012-01-23 22:05:59 +01:00
|
|
|
path => "${apt::params::root}/sources.list.d/${name}.list",
|
2011-05-30 19:24:06 +02:00
|
|
|
ensure => file,
|
|
|
|
owner => root,
|
|
|
|
group => root,
|
|
|
|
mode => 644,
|
|
|
|
content => template("apt/source.list.erb"),
|
2012-02-08 18:40:43 +01:00
|
|
|
|
2011-05-30 19:24:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if $pin != false {
|
2011-11-02 10:28:38 +01:00
|
|
|
apt::pin { "${release}": priority => "${pin}" } -> File["${name}.list"]
|
2011-05-30 19:24:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
exec { "${name} apt update":
|
2011-05-30 19:18:13 +02:00
|
|
|
command => "${apt::params::provider} update",
|
2011-05-30 19:24:06 +02:00
|
|
|
subscribe => File["${name}.list"],
|
|
|
|
refreshonly => true,
|
|
|
|
}
|
|
|
|
|
|
|
|
if $required_packages != false {
|
2011-05-30 19:18:13 +02:00
|
|
|
exec { "${apt::params::provider} -y install ${required_packages}":
|
2011-05-30 19:24:06 +02:00
|
|
|
subscribe => File["${name}.list"],
|
|
|
|
refreshonly => true,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if $key != false {
|
2011-06-03 09:20:00 +02:00
|
|
|
if $key_content {
|
2012-02-14 20:40:29 +01:00
|
|
|
exec { "Add key: ${key} from content for ${name}":
|
2011-06-03 09:20:00 +02:00
|
|
|
command => "/bin/echo '${key_content}' | /usr/bin/apt-key add -",
|
|
|
|
unless => "/usr/bin/apt-key list | /bin/grep '${key}'",
|
|
|
|
before => File["${name}.list"],
|
2012-02-04 02:24:09 +01:00
|
|
|
}
|
2011-06-03 09:20:00 +02:00
|
|
|
} else {
|
2012-02-14 20:40:29 +01:00
|
|
|
exec { "Add key: ${key} from ${key_server} for ${name}":
|
|
|
|
command => "/usr/bin/apt-key adv --keyserver ${key_server} --recv-keys ${key}",
|
2011-06-03 09:20:00 +02:00
|
|
|
unless => "/usr/bin/apt-key list | /bin/grep ${key}",
|
|
|
|
before => File["${name}.list"],
|
|
|
|
}
|
2011-05-30 19:24:06 +02:00
|
|
|
}
|
|
|
|
}
|
2010-04-27 22:38:28 +02:00
|
|
|
}
|