2015-04-07 13:51:10 +02:00
|
|
|
class apt::backports (
|
|
|
|
$location = undef,
|
|
|
|
$release = undef,
|
|
|
|
$repos = undef,
|
|
|
|
$key = undef,
|
|
|
|
$pin = 200,
|
2015-06-22 18:30:15 +02:00
|
|
|
){
|
2015-04-07 13:51:10 +02:00
|
|
|
if $location {
|
|
|
|
validate_string($location)
|
|
|
|
$_location = $location
|
|
|
|
}
|
|
|
|
if $release {
|
|
|
|
validate_string($release)
|
|
|
|
$_release = $release
|
|
|
|
}
|
|
|
|
if $repos {
|
|
|
|
validate_string($repos)
|
|
|
|
$_repos = $repos
|
|
|
|
}
|
|
|
|
if $key {
|
|
|
|
unless is_hash($key) {
|
|
|
|
validate_string($key)
|
|
|
|
}
|
|
|
|
$_key = $key
|
|
|
|
}
|
2015-06-22 18:30:15 +02:00
|
|
|
if ($::apt::xfacts['lsbdistid'] == 'debian' or $::apt::xfacts['lsbdistid'] == 'ubuntu') {
|
2015-04-07 13:51:10 +02:00
|
|
|
unless $location {
|
2015-06-22 18:30:15 +02:00
|
|
|
$_location = $::apt::backports['location']
|
2015-04-07 13:51:10 +02:00
|
|
|
}
|
|
|
|
unless $release {
|
2015-06-22 18:30:15 +02:00
|
|
|
$_release = "${::apt::xfacts['lsbdistcodename']}-backports"
|
2015-04-07 13:51:10 +02:00
|
|
|
}
|
|
|
|
unless $repos {
|
2015-06-22 18:30:15 +02:00
|
|
|
$_repos = $::apt::backports['repos']
|
2015-04-07 13:51:10 +02:00
|
|
|
}
|
|
|
|
unless $key {
|
2015-06-22 18:30:15 +02:00
|
|
|
$_key = $::apt::backports['key']
|
2015-04-07 13:51:10 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
unless $location and $release and $repos and $key {
|
|
|
|
fail('If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-27 01:29:54 +02:00
|
|
|
if is_hash($pin) {
|
|
|
|
$_pin = $pin
|
|
|
|
} elsif is_numeric($pin) or is_string($pin) {
|
|
|
|
# apt::source defaults to pinning to origin, but we should pin to release
|
|
|
|
# for backports
|
|
|
|
$_pin = {
|
|
|
|
'priority' => $pin,
|
|
|
|
'release' => $_release,
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
fail('pin must be either a string, number or hash')
|
|
|
|
}
|
|
|
|
|
2015-04-07 13:51:10 +02:00
|
|
|
apt::source { 'backports':
|
|
|
|
location => $_location,
|
|
|
|
release => $_release,
|
|
|
|
repos => $_repos,
|
|
|
|
key => $_key,
|
2015-08-27 01:29:54 +02:00
|
|
|
pin => $_pin,
|
2015-04-07 13:51:10 +02:00
|
|
|
}
|
|
|
|
}
|