[type/__locale_system] Add support for Gentoo Linux
This commit is contained in:
parent
47e28fc441
commit
0ef54a721d
1 changed files with 34 additions and 11 deletions
|
@ -24,9 +24,19 @@
|
||||||
# Configure system-wide locale by modifying i18n file.
|
# Configure system-wide locale by modifying i18n file.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
onchange_cmd= # none, by default
|
||||||
|
quote_value=false
|
||||||
|
|
||||||
|
catval() {
|
||||||
|
# shellcheck disable=SC2059
|
||||||
|
printf "$($quote_value && echo '"%s"' || echo '%s')" "$(cat "$1")"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
os=$(cat "$__global/explorer/os")
|
os=$(cat "$__global/explorer/os")
|
||||||
|
|
||||||
case "$os" in
|
case $os
|
||||||
|
in
|
||||||
debian)
|
debian)
|
||||||
os_version=$(cat "${__global}/explorer/os_version")
|
os_version=$(cat "${__global}/explorer/os_version")
|
||||||
if expr "${os_version}" '>=' 4 >/dev/null
|
if expr "${os_version}" '>=' 4 >/dev/null
|
||||||
|
@ -69,10 +79,24 @@ case "$os" in
|
||||||
if expr "${version_id}" '>=' 18 >/dev/null
|
if expr "${version_id}" '>=' 18 >/dev/null
|
||||||
then
|
then
|
||||||
locale_conf="/etc/locale.conf"
|
locale_conf="/etc/locale.conf"
|
||||||
|
quote_value=false
|
||||||
else
|
else
|
||||||
locale_conf="/etc/sysconfig/i18n"
|
locale_conf="/etc/sysconfig/i18n"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
gentoo)
|
||||||
|
case $(cat "${__global}/explorer/init")
|
||||||
|
in
|
||||||
|
(*openrc*)
|
||||||
|
locale_conf="/etc/env.d/02locale"
|
||||||
|
onchange_cmd="env-update --no-ldconfig"
|
||||||
|
quote_value=true
|
||||||
|
;;
|
||||||
|
(systemd)
|
||||||
|
locale_conf="/etc/locale.conf"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
|
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
|
||||||
echo "Please contribute an implementation for it if you can." >&2
|
echo "Please contribute an implementation for it if you can." >&2
|
||||||
|
@ -80,14 +104,13 @@ case "$os" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
__file "$locale_conf" \
|
__file "${locale_conf}" --state exists --owner root --group root --mode 0644
|
||||||
--owner root --group root --mode 0644 \
|
|
||||||
--state exists
|
|
||||||
|
|
||||||
require="__file/$locale_conf" \
|
require="__file/${locale_conf}" \
|
||||||
__key_value "$locale_conf:$__object_id" \
|
__key_value "${locale_conf}:${__object_id}" \
|
||||||
--file "$locale_conf" \
|
--file "${locale_conf}" \
|
||||||
--key "$__object_id" \
|
--key "${__object_id}" \
|
||||||
--delimiter '=' --exact_delimiter \
|
--delimiter '=' --exact_delimiter \
|
||||||
--state "$(cat "$__object/parameter/state")" \
|
--state "$(cat "${__object}/parameter/state")" \
|
||||||
--value "$(cat "$__object/parameter/value")"
|
--value "$(catval "${__object}/parameter/value")" \
|
||||||
|
--onchange "${onchange_cmd}"
|
||||||
|
|
Loading…
Reference in a new issue