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
|
# Configure locale
|
||||||
|
# This file is part of the init.sh project
|
||||||
# Copyright (c) 2019-2021 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
|
# Copyright (c) 2019-2021 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# This file is distributed under 3-clause BSD license.
|
# This file is distributed under 3-clause BSD license.
|
||||||
@@ -19,27 +20,42 @@
|
|||||||
# Character table (ISO or UTF)
|
# Character table (ISO or UTF)
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
export VER_conf_locale="0.0.3"
|
export VER_conf_locale^="0.1.0"
|
||||||
|
|
||||||
conf_locale()
|
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
|
for loc in $LOCALESET; do
|
||||||
prnt I "Activation de la locale ${loc}..."
|
prnt I "Activation de la locale ${loc}..."
|
||||||
sed -i "/^# $loc /s/^# //" /etc/locale.gen
|
sed -i "/^# $loc /s/^# //" $gen_fname
|
||||||
done
|
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..."
|
prnt I "Régénération du cache de locale..."
|
||||||
locale-gen
|
locale-gen
|
||||||
|
|
||||||
prnt I "Définition de la langue du systême..."*
|
prnt I "Définition de la langue du systême..."
|
||||||
[[ ! $SYSLOCALE ]] && export SYSLOCALE=C
|
[[ ! $SYSLOCALE ]] &&
|
||||||
local fname=/etc/default/locale
|
export SYSLOCALE=C
|
||||||
backupdist $fname
|
|
||||||
echo "# Generated by init on $(stdtime)" > $fname
|
local sys_fname=/etc/default/locale
|
||||||
echo "LANG=$SYSLOCALE" >> $fname
|
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 \
|
for cfg in ADDRESS IDENTIFICATION MEASUREMENT MONETARY NAME NUMERIC PAPER \
|
||||||
TELEPHONE TIME; do
|
TELEPHONE TIME; do
|
||||||
echo "LC_$cfg=$SYSLOCALE"
|
echo "LC_$cfg=$SYSLOCALE" >> $sys_fname
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user