aboutsummaryrefslogtreecommitdiff
path: root/modules/base_installation/manifests/locales.pp
blob: 0f31e0bf549e8b828fda734da143e608d8ba9d83 (plain) (blame)
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
class base_installation::locales inherits base_installation {
  # Note: we don't care about other lines, they are not handled in
  # Puppet
  define locale_line ($locale, $charmap = 'UTF-8') {
    file_line { "/etc/locale.gen#$locale":
      path   => '/etc/locale.gen',
      line   => "$locale $charmap  ",
      match  => "#?$locale $charmap +$",
      notify => Exec["/usr/bin/locale-gen"],
    }
  }

  unless empty($base_installation::system_locales) {
    $base_installation::system_locales.each |$locale| {
      base_installation::locales::locale_line { "/etc/locale.gen#$locale":
        locale => $locale
      }
    }

    $main_locale = $base_installation::system_locales[0]
    exec { "set_main_locale":
      command => "/usr/bin/systemd-firstboot --locale=$main_locale",
      creates => "/etc/locale.conf",
    }
  }

  exec { '/usr/bin/locale-gen':
    refreshonly => true,
  }


  file { "/etc/vconsole.conf":
    ensure => "link",
    target => "/dev/null",
  }

}