init.pp
1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
class locale (
$locales = 'en_US.UTF-8 pt_BR',
$lang = 'en_US.UTF-8',
$language = 'en_US'
) {
Exec {
path => ['/usr/bin', '/usr/sbin', '/bin']
}
file { '/var/cache/locale':
ensure => directory,
mode => '0755',
owner => 'root',
}
file { '/var/cache/locale/installed':
ensure => present,
mode => '0644',
owner => 'root',
content => "${locales}-${lang}-${language}",
require => File['/var/cache/locale'],
}
exec { 'install_locales':
command => "locale-gen ${locales}",
refreshonly => true,
subscribe => File['/var/cache/locale/installed'],
notify => Exec['reload_locales']
}
if $lang {
exec { 'update_default_lang':
command => "update-locale LANG='${lang}'",
notify => Exec['reload_locales'],
refreshonly => true,
subscribe => File['/var/cache/locale/installed'],
}
}
if $language {
exec { 'update_default_language':
command => "update-locale LANGUAGE='${language}'",
notify => Exec['reload_locales'],
refreshonly => true,
subscribe => File['/var/cache/locale/installed'],
}
}
exec { 'reload_locales':
command => "dpkg-reconfigure locales",
refreshonly => true
}
}