[type/__locale_system] RedHat systems on systemd use /etc/locale.conf

This commit is contained in:
Dennis Camera 2020-07-24 10:19:10 +02:00
parent 8b53f35ffa
commit a590504436

View file

@ -3,6 +3,7 @@
# 2012-2016 Steven Armstrong (steven-cdist at armstrong.cc) # 2012-2016 Steven Armstrong (steven-cdist at armstrong.cc)
# 2016 Carlos Ortigoza (carlos.ortigoza at ungleich.ch) # 2016 Carlos Ortigoza (carlos.ortigoza at ungleich.ch)
# 2016 Nico Schottelius (nico.schottelius at ungleich.ch) # 2016 Nico Schottelius (nico.schottelius at ungleich.ch)
# 2020 Dennis Camera (dennis.camera at ssrq-sds-fds.ch)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -32,8 +33,25 @@ case "$os" in
archlinux) archlinux)
locale_conf="/etc/locale.conf" locale_conf="/etc/locale.conf"
;; ;;
redhat|centos) centos|redhat|scientific)
# shellcheck source=/dev/null
version_id=$(. "${__global}/explorer/os_release" && echo "${VERSION_ID:-0}")
if expr "${version_id}" '>=' 7 >/dev/null
then
locale_conf="/etc/locale.conf"
else
locale_conf="/etc/sysconfig/i18n" locale_conf="/etc/sysconfig/i18n"
fi
;;
fedora)
# shellcheck source=/dev/null
version_id=$(. "${__global}/explorer/os_release" && echo "${VERSION_ID:-0}")
if expr "${version_id}" '>=' 18 >/dev/null
then
locale_conf="/etc/locale.conf"
else
locale_conf="/etc/sysconfig/i18n"
fi
;; ;;
*) *)
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
@ -50,6 +68,6 @@ 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 = \ --delimiter '=' --exact_delimiter \
--state "$(cat "$__object/parameter/state")" \ --state "$(cat "$__object/parameter/state")" \
--value "$(cat "$__object/parameter/value")" --value "$(cat "$__object/parameter/value")"