1 # @summary Manages backports.
3 # @example Set up a backport for linuxmint qiana
4 # apt::backports { 'qiana':
5 # location => 'http://us.archive.ubuntu.com/ubuntu',
6 # release => 'trusty-backports',
7 # repos => 'main universe multiverse restricted',
9 # id => '630239CC130E1A7FD81A27B140976EAF437D05B5',
10 # server => 'hkps.pool.sks-keyservers.net',
15 # Specifies an Apt repository containing the backports to manage. Valid options: a string containing a URL. Default value for Debian and
18 # - Debian: 'http://deb.debian.org/debian'
20 # - Ubuntu: 'http://archive.ubuntu.com/ubuntu'
23 # Specifies a distribution of the Apt repository containing the backports to manage. Used in populating the `source.list` configuration file.
24 # Default: on Debian and Ubuntu, '${lsbdistcodename}-backports'. We recommend keeping this default, except on other operating
28 # Specifies a component of the Apt repository containing the backports to manage. Used in populating the `source.list` configuration file.
29 # Default value for Debian and Ubuntu varies:
31 # - Debian: 'main contrib non-free'
33 # - Ubuntu: 'main universe multiverse restricted'
36 # Specifies a key to authenticate the backports. Valid options: a string to be passed to the id parameter of the apt::key defined type, or a
37 # hash of parameter => value pairs to be passed to apt::key's id, server, content, source, and/or options parameters. Default value
38 # for Debian and Ubuntu varies:
40 # - Debian: 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553'
42 # - Ubuntu: '630239CC130E1A7FD81A27B140976EAF437D05B5'
45 # Specifies a pin priority for the backports. Valid options: a number or string to be passed to the `id` parameter of the `apt::pin` defined
46 # type, or a hash of `parameter => value` pairs to be passed to `apt::pin`'s corresponding parameters.
48 class apt::backports (
49 Optional[String] $location = undef,
50 Optional[String] $release = undef,
51 Optional[String] $repos = undef,
52 Optional[Variant[String, Hash]] $key = undef,
53 Optional[Variant[Integer, String, Hash]] $pin = 200,
56 $_location = $location
67 if (!($facts['lsbdistid'] == 'Debian' or $facts['lsbdistid'] == 'Ubuntu')) {
68 unless $location and $release and $repos and $key {
69 fail(translate('If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key'))
73 $_location = $::apt::backports['location']
76 $_release = "${facts['lsbdistcodename']}-backports"
79 $_repos = $::apt::backports['repos']
82 $_key = $::apt::backports['key']
87 } elsif $pin =~ Numeric or $pin =~ String {
88 # apt::source defaults to pinning to origin, but we should pin to release
92 'release' => $_release,
95 fail(translate('pin must be either a string, number or hash'))
98 apt::source { 'backports':
99 location => $_location,
100 release => $_release,