forked from ungleich-public/cdist
[type/__locale_system] Fix floating point version comparison
This commit is contained in:
parent
7e1428ab3c
commit
885d5a58f4
1 changed files with 9 additions and 5 deletions
|
@ -24,6 +24,9 @@
|
||||||
# Configure system-wide locale by modifying i18n file.
|
# Configure system-wide locale by modifying i18n file.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
bccmp() { test "$(bc)" -gt 0; }
|
||||||
|
|
||||||
|
|
||||||
key=$__object_id
|
key=$__object_id
|
||||||
onchange_cmd= # none, by default
|
onchange_cmd= # none, by default
|
||||||
quote_value=false
|
quote_value=false
|
||||||
|
@ -41,7 +44,7 @@ case $os
|
||||||
in
|
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 printf '%f >= 4\n' "${os_version}" | bccmp
|
||||||
then
|
then
|
||||||
# Debian 4 (etch) and later
|
# Debian 4 (etch) and later
|
||||||
locale_conf="/etc/default/locale"
|
locale_conf="/etc/default/locale"
|
||||||
|
@ -54,7 +57,7 @@ in
|
||||||
;;
|
;;
|
||||||
ubuntu)
|
ubuntu)
|
||||||
os_version=$(cat "${__global}/explorer/os_version")
|
os_version=$(cat "${__global}/explorer/os_version")
|
||||||
if expr "${os_version}" '>=' 6.10 >/dev/null
|
if printf '%f >= 6.10\n' "${os_version}" | bccmp
|
||||||
then
|
then
|
||||||
# Ubuntu 6.10 (edgy) and later
|
# Ubuntu 6.10 (edgy) and later
|
||||||
locale_conf="/etc/default/locale"
|
locale_conf="/etc/default/locale"
|
||||||
|
@ -68,7 +71,7 @@ in
|
||||||
centos|redhat|scientific)
|
centos|redhat|scientific)
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
version_id=$(. "${__global}/explorer/os_release" && echo "${VERSION_ID:-0}")
|
version_id=$(. "${__global}/explorer/os_release" && echo "${VERSION_ID:-0}")
|
||||||
if expr "${version_id}" '>=' 7 >/dev/null
|
if printf '%f >= 7\n' "${version_id}" | bccmp
|
||||||
then
|
then
|
||||||
locale_conf="/etc/locale.conf"
|
locale_conf="/etc/locale.conf"
|
||||||
else
|
else
|
||||||
|
@ -78,7 +81,7 @@ in
|
||||||
fedora)
|
fedora)
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
version_id=$(. "${__global}/explorer/os_release" && echo "${VERSION_ID:-0}")
|
version_id=$(. "${__global}/explorer/os_release" && echo "${VERSION_ID:-0}")
|
||||||
if expr "${version_id}" '>=' 18 >/dev/null
|
if printf '%f >= 18\n' "${version_id}" | bccmp
|
||||||
then
|
then
|
||||||
locale_conf="/etc/locale.conf"
|
locale_conf="/etc/locale.conf"
|
||||||
quote_value=false
|
quote_value=false
|
||||||
|
@ -113,7 +116,8 @@ in
|
||||||
locale_conf="/etc/default/init"
|
locale_conf="/etc/default/init"
|
||||||
locale_conf_group="sys"
|
locale_conf_group="sys"
|
||||||
|
|
||||||
if expr "$(cat "${__global}/explorer/os_version")" '>=' 5.11 >/dev/null
|
os_version=$(cat "${__global}/explorer/os_version")
|
||||||
|
if printf '%f >= 5.11\n' "${os_version}" | bccmp
|
||||||
then
|
then
|
||||||
# mode on Oracle Solaris 11 is actually 0444,
|
# mode on Oracle Solaris 11 is actually 0444,
|
||||||
# but the write bit makes sense, IMO
|
# but the write bit makes sense, IMO
|
||||||
|
|
Loading…
Reference in a new issue