use localedef - locale-gen is a bad wrapper script
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								e0b009308a
							
						
					
				
			
			
				commit
				
					
						465749f377
					
				
			
		
					 5 changed files with 5 additions and 38 deletions
				
			
		| 
						 | 
				
			
			@ -1,37 +1,7 @@
 | 
			
		|||
cat << eof
 | 
			
		||||
 | 
			
		||||
archive="/usr/lib/locale/locale-archive"
 | 
			
		||||
locale=$__object_id
 | 
			
		||||
input=$(echo $locale | cut -d . -f 1)
 | 
			
		||||
charmap=$(echo $locale | cut -d . -f 2)
 | 
			
		||||
alias=/usr/share/locale/locale.alias
 | 
			
		||||
 | 
			
		||||
regen=no
 | 
			
		||||
 | 
			
		||||
if [ -f "$archive" ]; then
 | 
			
		||||
    config_time=\$(stat --format "%Z" /etc/locale.gen)
 | 
			
		||||
    archive_time=\$(stat --format "%Z" \"\$archive\")
 | 
			
		||||
 | 
			
		||||
    if [ "$config_time" -gt "$archive_time" ]; then
 | 
			
		||||
        regen=yes
 | 
			
		||||
    fi
 | 
			
		||||
else
 | 
			
		||||
    regen=yes
 | 
			
		||||
fi
 | 
			
		||||
    
 | 
			
		||||
if [ "\$regen" = yes ]; then
 | 
			
		||||
    locale-gen
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
eof
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## probably not needed, it seems to be /usr/lib/locale/locale-archive
 | 
			
		||||
## everwhere!
 | 
			
		||||
 | 
			
		||||
# tmp=\$(mktemp /tmp/cdist.XXXXXXXX)
 | 
			
		||||
# find /usr/lib/locale -mindepth 1 > \$tmp
 | 
			
		||||
# while read archive; do
 | 
			
		||||
#     archive_time=\$(stat --format "%Z" "\$archive\")
 | 
			
		||||
# 
 | 
			
		||||
#     if [ "\$config_time" -gt "\$archive_time" ]; then
 | 
			
		||||
#         regen=yes
 | 
			
		||||
#         break
 | 
			
		||||
#     fi
 | 
			
		||||
# done < "$\tmp"
 | 
			
		||||
echo localedef -A "$alias" -f "$charmap" -i "$input"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
present
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
state
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
name
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue