initial template for __locale
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								9ded11daf0
							
						
					
				
			
			
				commit
				
					
						e0b009308a
					
				
			
		
					 8 changed files with 101 additions and 0 deletions
				
			
		
							
								
								
									
										3
									
								
								cdist/conf/type/__locale/files/locale.gen
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								cdist/conf/type/__locale/files/locale.gen
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					de_CH.UTF-8 UTF-8
 | 
				
			||||||
 | 
					de_DE.UTF-8 UTF-8
 | 
				
			||||||
 | 
					en_US.UTF-8 UTF-8
 | 
				
			||||||
							
								
								
									
										37
									
								
								cdist/conf/type/__locale/gencode-remote
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								cdist/conf/type/__locale/gencode-remote
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,37 @@
 | 
				
			||||||
 | 
					cat << eof
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					archive="/usr/lib/locale/locale-archive"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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"
 | 
				
			||||||
							
								
								
									
										50
									
								
								cdist/conf/type/__locale/man.text
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								cdist/conf/type/__locale/man.text
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,50 @@
 | 
				
			||||||
 | 
					cdist-type__locale(7)
 | 
				
			||||||
 | 
					=====================
 | 
				
			||||||
 | 
					Nico Schottelius <nico-cdist--@--schottelius.org>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					cdist-type__locale - Configure locales
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					This cdist type allows you to setup the locales.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					REQUIRED MULTIPLE PARAMETERS
 | 
				
			||||||
 | 
					----------------------------
 | 
				
			||||||
 | 
					name::
 | 
				
			||||||
 | 
					    Specify the locale to be present
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					state::
 | 
				
			||||||
 | 
					   'present' or 'absent'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXAMPLES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					# Configure locales en_US and de_CH, both as UTF8
 | 
				
			||||||
 | 
					__locale --name "en_US.UTF-8 UTF-8" \
 | 
				
			||||||
 | 
					         --name "de_CH.UTF-8 UTF-8" \
 | 
				
			||||||
 | 
					         de_DE.UTF-8 UTF-8  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SEE ALSO
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					- locale(1)
 | 
				
			||||||
 | 
					- cdist-type(7)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					COPYING
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					Copyright \(C) 2013 Nico Schottelius. Free use of this software is
 | 
				
			||||||
 | 
					granted under the terms of the GNU General Public License version 3 (GPLv3).
 | 
				
			||||||
							
								
								
									
										8
									
								
								cdist/conf/type/__locale/manifest
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								cdist/conf/type/__locale/manifest
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,8 @@
 | 
				
			||||||
 | 
					locales=$(cat "$__object/parameter/name")
 | 
				
			||||||
 | 
					state=$(cat "$__object/parameter/state")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__package locales --state $state
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__file /etc/locale.gen \
 | 
				
			||||||
 | 
					    --mode 0644 \
 | 
				
			||||||
 | 
					    --source "$__object/parameter/name"
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__locale/parameter/default/state
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__locale/parameter/default/state
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					present
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__locale/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__locale/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__locale/parameter/required_multiple
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__locale/parameter/required_multiple
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					name
 | 
				
			||||||
							
								
								
									
										0
									
								
								cdist/conf/type/__locale/singleton
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__locale/singleton
									
										
									
									
									
										Normal file
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue