--- /dev/null
+class apt::backports (
+ $location = undef,
+ $release = undef,
+ $repos = undef,
+ $key = undef,
+ $pin = 200,
+){
+ 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
+ }
+ unless is_hash($pin) {
+ unless (is_numeric($pin) or is_string($pin)) {
+ fail('pin must be either a string, number or hash')
+ }
+ }
+
+ if ($::apt::xfacts['lsbdistid'] == 'debian' or $::apt::xfacts['lsbdistid'] == 'ubuntu') {
+ unless $location {
+ $_location = $::apt::backports['location']
+ }
+ unless $release {
+ $_release = "${::apt::xfacts['lsbdistcodename']}-backports"
+ }
+ unless $repos {
+ $_repos = $::apt::backports['repos']
+ }
+ unless $key {
+ $_key = $::apt::backports['key']
+ }
+ } 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')
+ }
+ }
+
+ apt::source { 'backports':
+ location => $_location,
+ release => $_release,
+ repos => $_repos,
+ key => $_key,
+ pin => $pin,
+ }
+
+}
}
}
case $distid {
+ 'debian': {
+ case $distcodename {
+ 'squeeze': {
+ $backports = {'location' => 'http://backports.debian.org/debian-backports',
+ 'key' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
+ 'repos' => 'main contrib non-free',
+ }
+ }
+ default: {
+ $backports = {'location' => 'http://ftp.debian.org/debian/',
+ 'key' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD624692555',
+ 'repos' => 'main contrib non-free',
+ }
+ }
+ }
+ }
'ubuntu': {
+ $backports = {'location' => 'http://archive.ubuntu.com/ubuntu',
+ 'key' => '630239CC130E1A7FD81A27B140976EAF437D05B5',
+ 'repos' => 'main universe multiverse restricted',
+ }
case $distcodename {
'lucid': {
$ppa_options = undef