b97a8a25bf7c2e121e3d26f96d7b6d67cc283f8c
[puppet-modules/puppetlabs-apt.git] / manifests / params.pp
1 class apt::params {
2   $root           = '/etc/apt'
3   $provider       = '/usr/bin/apt-get'
4   $sources_list_d = "${root}/sources.list.d"
5   $apt_conf_d     = "${root}/apt.conf.d"
6   $preferences_d  = "${root}/preferences.d"
7
8   if $::osfamily != 'Debian' {
9     fail('This module only works on Debian or derivatives like Ubuntu')
10   }
11
12   case $::lsbdistid {
13     'ubuntu', 'debian': {
14       $distid = $::lsbdistid
15       $distcodename = $::lsbdistcodename
16     }
17     'linuxmint': {
18       if $::lsbdistcodename == 'debian' {
19         $distid = 'debian'
20         $distcodename = 'wheezy'
21       } else {
22         $distid = 'ubuntu'
23         $distcodename = $::lsbdistcodename ? {
24           'qiana'  => 'trusty',
25           'petra'  => 'saucy',
26           'olivia' => 'raring',
27           'nadia'  => 'quantal',
28           'maya'   => 'precise',
29         }
30       }
31     }
32     '': {
33       fail('Unable to determine lsbdistid, is lsb-release installed?')
34     }
35     default: {
36       fail("Unsupported lsbdistid (${::lsbdistid})")
37     }
38   }
39   case $distid {
40     'debian': {
41       case $distcodename {
42         'squeeze': {
43           $backports_location = 'http://backports.debian.org/debian-backports'
44           $legacy_origin       = true
45           $origins             = ['${distro_id} oldstable', #lint:ignore:single_quote_string_with_variables
46                                   '${distro_id} ${distro_codename}-security', #lint:ignore:single_quote_string_with_variables
47                                   '${distro_id} ${distro_codename}-lts'] #lint:ignore:single_quote_string_with_variables
48         }
49         'wheezy': {
50           $backports_location = 'http://ftp.debian.org/debian/'
51           $legacy_origin      = false
52           $origins            = ['origin=Debian,archive=stable,label=Debian-Security',
53                                   'origin=Debian,archive=oldstable,label=Debian-Security']
54         }
55         default: {
56           $backports_location = 'http://http.debian.net/debian/'
57           $legacy_origin      = false
58           $origins            = ['origin=Debian,archive=stable,label=Debian-Security']
59         }
60       }
61     }
62     'ubuntu': {
63       case $distcodename {
64         'lucid': {
65           $backports_location = 'http://us.archive.ubuntu.com/ubuntu'
66           $ppa_options        = undef
67           $legacy_origin      = true
68           $origins            = ['${distro_id} ${distro_codename}-security'] #lint:ignore:single_quote_string_with_variables
69         }
70         'precise', 'trusty', 'utopic', 'vivid': {
71           $backports_location = 'http://us.archive.ubuntu.com/ubuntu'
72           $ppa_options        = '-y'
73           $legacy_origin      = true
74           $origins            = ['${distro_id}:${distro_codename}-security'] #lint:ignore:single_quote_string_with_variables
75         }
76         default: {
77           $backports_location = 'http://old-releases.ubuntu.com/ubuntu'
78           $ppa_options        = '-y'
79           $legacy_origin      = true
80           $origins            = ['${distro_id}:${distro_codename}-security'] #lint:ignore:single_quote_string_with_variables
81         }
82       }
83     }
84   }
85 }