[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)
# 2016 Carlos Ortigoza (carlos.ortigoza 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.
#
@ -32,8 +33,25 @@ case "$os" in
archlinux)
locale_conf="/etc/locale.conf"
;;
redhat|centos)
locale_conf="/etc/sysconfig/i18n"
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"
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
@ -47,9 +65,9 @@ __file "$locale_conf" \
--state exists
require="__file/$locale_conf" \
__key_value "$locale_conf:$__object_id" \
__key_value "$locale_conf:$__object_id" \
--file "$locale_conf" \
--key "$__object_id" \
--delimiter = \
--delimiter '=' --exact_delimiter \
--state "$(cat "$__object/parameter/state")" \
--value "$(cat "$__object/parameter/value")"