|
1 | 1 | # @summary Manages backports. |
2 | 2 | # |
3 | | -# @example Set up a backport source for Linux Mint qiana |
4 | | -# class { 'apt::backports': |
5 | | -# location => 'http://us.archive.ubuntu.com/ubuntu', |
6 | | -# release => 'trusty-backports', |
7 | | -# repos => 'main universe multiverse restricted', |
8 | | -# key => { |
9 | | -# id => '630239CC130E1A7FD81A27B140976EAF437D05B5', |
10 | | -# server => 'keyserver.ubuntu.com', |
11 | | -# }, |
12 | | -# } |
| 3 | +# @example Set up a backport source for Ubuntu |
| 4 | +# include apt::backports |
13 | 5 | # |
14 | 6 | # @param location |
15 | 7 | # Specifies an Apt repository containing the backports to manage. Valid options: a string containing a URL. Default value for Debian and |
|
36 | 28 | # 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 | 29 | # hash of parameter => value pairs to be passed to apt::key's id, server, content, source, and/or options parameters. |
38 | 30 | # |
| 31 | +# @param keyring |
| 32 | +# Absolute path to a file containing the PGP keyring used to sign this |
| 33 | +# repository. Value is passed to the apt::source and used to set signed-by on |
| 34 | +# the source entry. |
| 35 | +# |
39 | 36 | # @param pin |
40 | 37 | # 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 |
41 | 38 | # type, or a hash of `parameter => value` pairs to be passed to `apt::pin`'s corresponding parameters. |
|
48 | 45 | Optional[String] $release = undef, |
49 | 46 | Optional[String] $repos = undef, |
50 | 47 | Optional[Variant[String, Hash]] $key = undef, |
| 48 | + Stdlib::AbsolutePath $keyring = "/usr/share/keyrings/${facts['os']['name'].downcase}-archive-keyring.gpg", |
51 | 49 | Variant[Integer, String, Hash] $pin = 200, |
52 | 50 | Variant[Hash] $include = {}, |
53 | 51 | ) { |
|
56 | 54 | if $location { |
57 | 55 | $_location = $location |
58 | 56 | } |
| 57 | + |
59 | 58 | if $release { |
60 | 59 | $_release = $release |
61 | 60 | } |
| 61 | + |
62 | 62 | if $repos { |
63 | 63 | $_repos = $repos |
64 | 64 | } |
65 | 65 |
|
66 | 66 | if (!($facts['os']['name'] == 'Debian' or $facts['os']['name'] == 'Ubuntu')) { |
67 | | - unless $location and $release and $repos and $key { |
68 | | - fail('If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key') |
| 67 | + unless $location and $release and $repos { |
| 68 | + fail('If not on Debian or Ubuntu, you must explicitly pass location, release, and repos') |
69 | 69 | } |
70 | 70 | } |
| 71 | + |
71 | 72 | unless $location { |
72 | 73 | $_location = $apt::backports['location'] |
73 | 74 | } |
| 75 | + |
74 | 76 | unless $release { |
75 | 77 | if fact('os.distro.codename') { |
76 | 78 | $_release = "${fact('os.distro.codename')}-backports" |
77 | 79 | } else { |
78 | 80 | fail('os.distro.codename fact not available: release parameter required') |
79 | 81 | } |
80 | 82 | } |
| 83 | + |
81 | 84 | unless $repos { |
82 | 85 | $_repos = $apt::backports['repos'] |
83 | 86 | } |
84 | 87 |
|
| 88 | + $_keyring = if $key { |
| 89 | + undef |
| 90 | + } else { |
| 91 | + $keyring |
| 92 | + } |
| 93 | + |
85 | 94 | if $pin =~ Hash { |
86 | 95 | $_pin = $pin |
87 | 96 | } elsif $pin =~ Numeric or $pin =~ String { |
|
101 | 110 | repos => $_repos, |
102 | 111 | include => $include, |
103 | 112 | key => $key, |
| 113 | + keyring => $_keyring, |
104 | 114 | pin => $_pin, |
105 | 115 | } |
106 | 116 | } |
0 commit comments