summarylogtreecommitdiffstats
path: root/locale-en_xx.install
blob: 7f405f1aeb28e30f3306a3d0d57b091d4e65461d (plain)
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
_old_locale_name='en_XX.UTF-8@POSIX'
_old_locale_gen_entry="$_old_locale_name"' UTF-8'
_old_regex='\s*'"${_old_locale_gen_entry/./\\.}"'\s*$'
_old_regex_general='^\s*#\?'"$_old_regex"
_old_regex_commented='^\s*#'"$_old_regex"

_locale_name='en_XX@POSIX'
_locale_gen_entry="$_locale_name"' UTF-8'
_regex='\s*'"${_locale_gen_entry/./\\.}"'\s*$'
_regex_general='^\s*#\?'"$_regex"
_regex_commented='^\s*#'"$_regex"

post_install ()
{
  # Add the locale to locale.gen if absent.
  grep -q "$_regex_general" etc/locale.gen || \
    echo "$_locale_gen_entry" >> etc/locale.gen

  # Update locales if the locale is uncommented.
  grep -q "$_regex_commented" etc/locale.gen || \
    usr/bin/locale-gen
}



post_upgrade ()
{
  # Update locales if the locale is uncommented.
  grep -q "$_regex_commented" etc/locale.gen || \
    usr/bin/locale-gen
}



pre_remove ()
{
  # Remove the locale from the archive.
  usr/bin/localedef --delete-from-archive "$_locale_name"

  # Remove the locale from locale.gen.
  sed -i '/'"$_regex_general"'/d' etc/locale.gen
}

# vim: set ts=2 sw=2 et: