8f9d7e85f48f4a2025f6e6c4943f2529493de1ad
[puppet-modules/puppetlabs-apt.git] / manifests / params.pp
1 class apt::params {
2
3   if $caller_module_name and $caller_module_name != $module_name {
4     fail('apt::params is a private class and cannot be accessed directly')
5   }
6
7   $root           = '/etc/apt'
8   $provider       = '/usr/bin/apt-get'
9   $sources_list   = "${root}/sources.list"
10   $sources_list_d = "${root}/sources.list.d"
11   $conf_d         = "${root}/apt.conf.d"
12   $preferences    = "${root}/preferences"
13   $preferences_d  = "${root}/preferences.d"
14
15   if $::osfamily != 'Debian' {
16     fail('This module only works on Debian or derivatives like Ubuntu')
17   }
18
19   $config_files = {
20     'conf'   => {
21       'path' => $conf_d,
22       'ext'  => '',
23     },
24     'pref'   => {
25       'path' => $preferences_d,
26       'ext'  => '',
27     },
28     'list'   => {
29       'path' => $sources_list_d,
30       'ext'  => '.list',
31     }
32   }
33
34   $file_defaults = {
35     'owner' => 'root',
36     'group' => 'root',
37     'mode'  => '0644',
38   }
39
40   case $::lsbdistid {
41     'ubuntu', 'debian': {
42       $distid = $::lsbdistid
43       $distcodename = $::lsbdistcodename
44     }
45     'linuxmint': {
46       if $::lsbdistcodename == 'debian' {
47         $distid = 'debian'
48         $distcodename = 'wheezy'
49       } else {
50         $distid = 'ubuntu'
51         $distcodename = $::lsbdistcodename ? {
52           'qiana'  => 'trusty',
53           'petra'  => 'saucy',
54           'olivia' => 'raring',
55           'nadia'  => 'quantal',
56           'maya'   => 'precise',
57         }
58       }
59     }
60     '': {
61       fail('Unable to determine lsbdistid, is lsb-release installed?')
62     }
63     default: {
64       fail("Unsupported lsbdistid (${::lsbdistid})")
65     }
66   }
67   case $distid {
68     'ubuntu': {
69       case $distcodename {
70         'lucid': {
71           $ppa_options        = undef
72           $ppa_package        = 'python-software-properties'
73         }
74         'precise': {
75           $ppa_options        = '-y'
76           $ppa_package        = 'python-software-properties'
77         }
78         'trusty', 'utopic', 'vivid': {
79           $ppa_options        = '-y'
80           $ppa_package        = 'software-properties-common'
81         }
82         default: {
83           $ppa_options        = '-y'
84           $ppa_package        = 'software-properties-common'
85         }
86       }
87     }
88   }
89 }