forked from ungleich-public/cdist
		
	pass out dir to bin/cdist-type-build-emulation
because __cdist_out_type_bin_dir is script specific Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								1dc963ea4b
							
						
					
				
			
			
				commit
				
					
						30b1f2632a
					
				
			
		
					 2 changed files with 17 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -24,7 +24,7 @@
 | 
			
		|||
 | 
			
		||||
. cdist-config
 | 
			
		||||
[ $# -eq 3 ] || __cdist_usage "<target host> <manifest> <out dir>"
 | 
			
		||||
set -u
 | 
			
		||||
set -ux
 | 
			
		||||
 | 
			
		||||
__cdist_target_host="$1"; shift
 | 
			
		||||
__cdist_manifest="$1"; shift
 | 
			
		||||
| 
						 | 
				
			
			@ -37,14 +37,18 @@ __cdist_work_dir="$__cdist_local_base_dir"
 | 
			
		|||
export __cdist_output_dir __cdist_manifest
 | 
			
		||||
 | 
			
		||||
# Ensure binaries exist and are up-to-date
 | 
			
		||||
cdist-type-build-emulation || __cdist_exit_err "Failed to build type emulation binaries"
 | 
			
		||||
cdist-type-build-emulation "${__cdist_out_type_bin_dir}" \
 | 
			
		||||
   || __cdist_exit_err "Failed to build type emulation binaries"
 | 
			
		||||
 | 
			
		||||
# prepend our path, so all cdist tools come before other tools
 | 
			
		||||
PATH="${__cdist_out_type_bin_dir}:$PATH"
 | 
			
		||||
export PATH="${__cdist_out_type_bin_dir}:$PATH"
 | 
			
		||||
 | 
			
		||||
# Force -x, so the user is aware the file is executed
 | 
			
		||||
[ -x "${__cdist_manifest}" ] || __cdist_exit_err "${__cdist_manifest} needs to be executable."
 | 
			
		||||
mkdir -p "${__cdist_output_dir}" || __cdist_exit_err "Cannot create output dir ${__cdist_output_dir}"
 | 
			
		||||
cd "$__cdist_work_dir" || __cdist_exit_err "Cannot change to work dir \"$__cdist_work_dir\"."
 | 
			
		||||
[ -x "${__cdist_manifest}" ] \
 | 
			
		||||
   || __cdist_exit_err "${__cdist_manifest} needs to be executable."
 | 
			
		||||
mkdir -p "${__cdist_output_dir}" \
 | 
			
		||||
   || __cdist_exit_err "Cannot create output dir ${__cdist_output_dir}"
 | 
			
		||||
cd "$__cdist_work_dir" \
 | 
			
		||||
   || __cdist_exit_err "Cannot change to work dir \"$__cdist_work_dir\"."
 | 
			
		||||
 | 
			
		||||
__cdist_exec_fail_on_error "${__cdist_manifest}" "$@"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,12 +21,14 @@
 | 
			
		|||
#
 | 
			
		||||
 | 
			
		||||
. cdist-config
 | 
			
		||||
set -aeu
 | 
			
		||||
[ $# -eq 1 ] || __cdist_usage "<out dir>"
 | 
			
		||||
set -eu
 | 
			
		||||
 | 
			
		||||
__cdist_output_dir="$1"; shift
 | 
			
		||||
 | 
			
		||||
# FIXME: load this from the cdist-core library
 | 
			
		||||
__cdist_type_emulator="$(which cdist-type-emulator)"
 | 
			
		||||
 | 
			
		||||
if [ ! -d ${__cdist_type_dir} ]; then
 | 
			
		||||
if [ ! -d "${__cdist_type_dir}" ]; then
 | 
			
		||||
   __cdist_exit_err "$__cdist_type_dir must exist and contain available types"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -35,7 +37,7 @@ cd "${__cdist_type_dir}"
 | 
			
		|||
ls -1 > "${__cdist_tmp_file}"
 | 
			
		||||
 | 
			
		||||
# Create binaries
 | 
			
		||||
mkdir -p "${__cdist_out_type_bin_dir}"
 | 
			
		||||
mkdir -p "${__cdist_output_dir}"
 | 
			
		||||
while read type; do
 | 
			
		||||
   ln -sf "${__cdist_type_emulator}" "${__cdist_out_type_bin_dir}/${type}"
 | 
			
		||||
   ln -sf "${__cdist_type_emulator}" "${__cdist_output_dir}/${type}"
 | 
			
		||||
done < "${__cdist_tmp_file}"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue