backports.pp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. if ! is_integer($pin_priority) {
  37. fail('$pin_priority must be an integer')
  38. }
  39. if $::lsbdistid == 'LinuxMint' {
  40. if $::lsbdistcodename == 'debian' {
  41. $distid = 'debian'
  42. $release_real = 'wheezy'
  43. } else {
  44. $distid = 'ubuntu'
  45. $release_real = $::lsbdistcodename ? {
  46. 'qiana' => 'trusty',
  47. 'petra' => 'saucy',
  48. 'olivia' => 'raring',
  49. 'nadia' => 'quantal',
  50. 'maya' => 'precise',
  51. }
  52. }
  53. } else {
  54. $distid = $::lsbdistid
  55. $release_real = downcase($release)
  56. }
  57. $key = $distid ? {
  58. 'debian' => '46925553',
  59. 'ubuntu' => '437D05B5',
  60. }
  61. $repos = $distid ? {
  62. 'debian' => 'main contrib non-free',
  63. 'ubuntu' => 'main universe multiverse restricted',
  64. }
  65. apt::pin { 'backports':
  66. before => Apt::Source['backports'],
  67. release => "${release_real}-backports",
  68. priority => $pin_priority,
  69. }
  70. apt::source { 'backports':
  71. location => $location,
  72. release => "${release_real}-backports",
  73. repos => $repos,
  74. key => $key,
  75. key_server => 'pgp.mit.edu',
  76. }
  77. }