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',
|
|
|
|
$pin = 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":
|
2011-05-30 19:18:13 +02:00
|
|
|
name => "${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"),
|
|
|
|
}
|
|
|
|
|
|
|
|
if $pin != false {
|
|
|
|
apt::pin { "${release}": priority => "${pin}" }
|
|
|
|
}
|
|
|
|
|
|
|
|
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 {
|
|
|
|
exec { "/usr/bin/apt-key adv --keyserver ${key_server} --recv-keys ${key}":
|
|
|
|
unless => "/usr/bin/apt-key list | grep ${key}",
|
|
|
|
before => File["${name}.list"],
|
|
|
|
}
|
|
|
|
}
|
2010-04-27 22:38:28 +02:00
|
|
|
}
|