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.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
bccmp() { test "$(bc)" -gt 0; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
key=$__object_id
 | 
			
		||||
onchange_cmd=  # none, by default
 | 
			
		||||
quote_value=false
 | 
			
		||||
| 
						 | 
				
			
			@ -41,7 +44,7 @@ case $os
 | 
			
		|||
in
 | 
			
		||||
    debian)
 | 
			
		||||
        os_version=$(cat "${__global}/explorer/os_version")
 | 
			
		||||
        if expr "${os_version}" '>=' 4 >/dev/null
 | 
			
		||||
        if printf '%f >= 4\n' "${os_version}" | bccmp
 | 
			
		||||
        then
 | 
			
		||||
            # Debian 4 (etch) and later
 | 
			
		||||
            locale_conf="/etc/default/locale"
 | 
			
		||||
| 
						 | 
				
			
			@ -54,7 +57,7 @@ in
 | 
			
		|||
        ;;
 | 
			
		||||
    ubuntu)
 | 
			
		||||
        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
 | 
			
		||||
            # Ubuntu 6.10 (edgy) and later
 | 
			
		||||
            locale_conf="/etc/default/locale"
 | 
			
		||||
| 
						 | 
				
			
			@ -68,7 +71,7 @@ in
 | 
			
		|||
    centos|redhat|scientific)
 | 
			
		||||
        # shellcheck source=/dev/null
 | 
			
		||||
        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
 | 
			
		||||
            locale_conf="/etc/locale.conf"
 | 
			
		||||
        else
 | 
			
		||||
| 
						 | 
				
			
			@ -78,7 +81,7 @@ in
 | 
			
		|||
    fedora)
 | 
			
		||||
        # shellcheck source=/dev/null
 | 
			
		||||
        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
 | 
			
		||||
            locale_conf="/etc/locale.conf"
 | 
			
		||||
            quote_value=false
 | 
			
		||||
| 
						 | 
				
			
			@ -113,7 +116,8 @@ in
 | 
			
		|||
        locale_conf="/etc/default/init"
 | 
			
		||||
        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
 | 
			
		||||
            # mode on Oracle Solaris 11 is actually 0444,
 | 
			
		||||
            # but the write bit makes sense, IMO
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue