added removal of unspecified locale, rework on local vars, 0.0.3 -> 0.1.0
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configure locale
|
||||
# This file is part of the init.sh project
|
||||
# Copyright (c) 2019-2021 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
|
||||
# ------------------------------------------------------------------------------
|
||||
# This file is distributed under 3-clause BSD license.
|
||||
@@ -19,27 +20,42 @@
|
||||
# Character table (ISO or UTF)
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
export VER_conf_locale="0.0.3"
|
||||
export VER_conf_locale^="0.1.0"
|
||||
|
||||
conf_locale()
|
||||
{
|
||||
backupdist /etc/locale.gen
|
||||
local gen_fname=/etc/locale.gen
|
||||
backupdist $gen_fname
|
||||
|
||||
# Adding locales not yet enabled
|
||||
for loc in $LOCALESET; do
|
||||
prnt I "Activation de la locale ${loc}..."
|
||||
sed -i "/^# $loc /s/^# //" /etc/locale.gen
|
||||
sed -i "/^# $loc /s/^# //" $gen_fname
|
||||
done
|
||||
unset loc
|
||||
|
||||
# Removing locales not in the list
|
||||
while IFS= read -r line; do
|
||||
if [[ ! $(echo $LOCALESET | grep $line) ]]; then
|
||||
sed -i "s/^$line/# $line" $gen_fname
|
||||
fi
|
||||
done
|
||||
unset $gen_fname
|
||||
|
||||
prnt I "Régénération du cache de locale..."
|
||||
locale-gen
|
||||
|
||||
prnt I "Définition de la langue du systême..."*
|
||||
[[ ! $SYSLOCALE ]] && export SYSLOCALE=C
|
||||
local fname=/etc/default/locale
|
||||
backupdist $fname
|
||||
echo "# Generated by init on $(stdtime)" > $fname
|
||||
echo "LANG=$SYSLOCALE" >> $fname
|
||||
prnt I "Définition de la langue du systême..."
|
||||
[[ ! $SYSLOCALE ]] &&
|
||||
export SYSLOCALE=C
|
||||
|
||||
local sys_fname=/etc/default/locale
|
||||
backupdist $sys_fname
|
||||
echo "# Generated by init on $(stdtime)" > $sys_fname
|
||||
echo "LANG=$SYSLOCALE" >> $sys_fname
|
||||
for cfg in ADDRESS IDENTIFICATION MEASUREMENT MONETARY NAME NUMERIC PAPER \
|
||||
TELEPHONE TIME; do
|
||||
echo "LC_$cfg=$SYSLOCALE"
|
||||
echo "LC_$cfg=$SYSLOCALE" >> $sys_fname
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user