]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/blob - manifests/backports.pp
add support for LinuxMint operating system
[puppet-modules/puppetlabs-apt.git] / manifests / backports.pp
1 # This adds the necessary components to get backports for ubuntu and debian
2 #
3 # == Parameters
4 #
5 # [*release*]
6 #   The ubuntu/debian release name. Defaults to $lsbdistcodename. Setting this
7 #   manually can cause undefined behavior. (Read: universe exploding)
8 #
9 # [*pin_priority*]
10 #   _default_: 200
11 #
12 #   The priority that should be awarded by default to all packages coming from
13 #   the Debian Backports project.
14 #
15 # == Examples
16 #
17 #   include apt::backports
18 #
19 #   class { 'apt::backports':
20 #     release => 'natty',
21 #   }
22 #
23 # == Authors
24 #
25 # Ben Hughes, I think. At least blame him if this goes wrong.
26 # I just added puppet doc.
27 #
28 # == Copyright
29 #
30 # Copyright 2011 Puppet Labs Inc, unless otherwise noted.
31 class apt::backports(
32   $release      = $::lsbdistcodename,
33   $location     = $::apt::params::backports_location,
34   $pin_priority = 200,
35 ) inherits apt::params {
36
37   if ! is_integer($pin_priority) {
38     fail('$pin_priority must be an integer')
39   }
40
41   if $::lsbdistid == 'LinuxMint' {
42     $distid = $::lsbdistcodename ? {
43       'debian' => 'debian',
44       default  => 'ubuntu',
45     }
46     $release_real = $::lsbdistcodename ? {
47       'debian' => 'wheezy',
48       'qiana'  => 'trusty',
49       'petra'  => 'saucy',
50       'olivia' => 'raring',
51       'nadia'  => 'quantal',
52       'maya'   => 'precise',
53     }
54   } else {
55     $distid = $::lsbdistid
56     $release_real = downcase($release)
57   }
58
59   $key = $distid ? {
60     'debian' => '46925553',
61     'ubuntu' => '437D05B5',
62   }
63   $repos = $distid ? {
64     'debian' => 'main contrib non-free',
65     'ubuntu' => 'main universe multiverse restricted',
66   }
67
68   apt::source { 'backports':
69     location   => $location,
70     release    => "${release_real}-backports",
71     repos      => $repos,
72     key        => $key,
73     key_server => 'pgp.mit.edu',
74     pin        => $pin_priority,
75   }
76 }