finish cdist-code-gen
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								709271fd2e
							
						
					
				
			
			
				commit
				
					
						e4fbb1a5d8
					
				
			
		
					 1 changed files with 21 additions and 6 deletions
				
			
		| 
						 | 
					@ -23,21 +23,36 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
. cdist-config
 | 
					. cdist-config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[ $# -eq 2 ] || __cdist_usage "<target host>" "<object>"
 | 
					[ $# -eq 3 ] || __cdist_usage "<target host>" "<object_base_dir>" "<object>"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set -ue
 | 
					set -ue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export __cdist_target_host="$1"; shift
 | 
					export __cdist_target_host="$1"; shift
 | 
				
			||||||
 | 
					export __cdist_object_base_dir="$1"; shift
 | 
				
			||||||
export __cdist_object="$1"; shift
 | 
					export __cdist_object="$1"; shift
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Full path to object
 | 
				
			||||||
 | 
					export __cdist_object_dir="${__cdist_object_base_dir}/${__cdist_object}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Get type from object path
 | 
					# Get type from object path
 | 
				
			||||||
export __cdist_type=${__cdist_object%%/*}
 | 
					export __cdist_type="${__cdist_object%%/*}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Full path to where the executable should exist, if the type has one
 | 
					# Get id from object path (i.e no type prefix)
 | 
				
			||||||
export __cdist_gencode="${__cdist_type_dir}/$__cdist_type/$__cdist_name_gencode"
 | 
					export __cdist_object_id="${__cdist_object#*/}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Full path to where the executable of the type should exist, if the type has one
 | 
				
			||||||
 | 
					gencode="$(__cdist_type_gencode "$__cdist_type")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cd "$__cdist_object_dir"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Call gencode of type with __cdist_object
 | 
					# Call gencode of type with __cdist_object
 | 
				
			||||||
if [ -x "$__cdist_gencode" ]; then
 | 
					if [ -x "$gencode" ]; then
 | 
				
			||||||
   "$__cdist_gencode"
 | 
					   cat << eof
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Code imported from $gencode
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					eof
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   "$gencode"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue