apt: Add apt::setting defined type.
[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   = "${root}/sources.list"
5   $sources_list_d = "${root}/sources.list.d"
6   $conf_d         = "${root}/apt.conf.d"
7   $preferences    = "${root}/preferences"
8   $preferences_d  = "${root}/preferences.d"
9
10   if $::osfamily != 'Debian' {
11     fail('This module only works on Debian or derivatives like Ubuntu')
12   }
13
14   $config_files = {
15     'conf'   => {
16       'path' => $conf_d,
17       'ext'  => '',
18     },
19     'pref'   => {
20       'path' => $preferences_d,
21       'ext'  => '',
22     },
23     'list'   => {
24       'path' => $sources_list_d,
25       'ext'  => '.list',
26     }
27   }
28
29   $file_defaults = {
30     'owner' => 'root',
31     'group' => 'root',
32     'mode'  => '0644',
33   }
34
35   case $::lsbdistid {
36     'ubuntu', 'debian': {
37       $distid = $::lsbdistid
38       $distcodename = $::lsbdistcodename
39     }
40     'linuxmint': {
41       if $::lsbdistcodename == 'debian' {
42         $distid = 'debian'
43         $distcodename = 'wheezy'
44       } else {
45         $distid = 'ubuntu'
46         $distcodename = $::lsbdistcodename ? {
47           'qiana'  => 'trusty',
48           'petra'  => 'saucy',
49           'olivia' => 'raring',
50           'nadia'  => 'quantal',
51           'maya'   => 'precise',
52         }
53       }
54     }
55     '': {
56       fail('Unable to determine lsbdistid, is lsb-release installed?')
57     }
58     default: {
59       fail("Unsupported lsbdistid (${::lsbdistid})")
60     }
61   }
62   case $distid {
63     'ubuntu': {
64       case $distcodename {
65         'lucid': {
66           $ppa_options        = undef
67         }
68         'precise', 'trusty', 'utopic', 'vivid': {
69           $ppa_options        = '-y'
70         }
71         default: {
72           $ppa_options        = '-y'
73         }
74       }
75     }
76   }
77 }