add local/remote code run capability
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								6f79f01206
							
						
					
				
			
			
				commit
				
					
						1785f5acd0
					
				
			
		
					 1 changed files with 5 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -22,30 +22,30 @@
 | 
			
		|||
# 
 | 
			
		||||
 | 
			
		||||
. cdist-config
 | 
			
		||||
[ $# -eq 2 ] || __cdist_usage "<object dir> <object>"
 | 
			
		||||
[ $# -eq 3 ] || __cdist_usage "<object dir> <object> <type>"
 | 
			
		||||
set -ue
 | 
			
		||||
 | 
			
		||||
# This variable MUST be exactly like this - see __cdist_object_dir
 | 
			
		||||
__cdist_out_object_dir="$1"; shift
 | 
			
		||||
 | 
			
		||||
object="$1"; shift
 | 
			
		||||
__cdist_gencode_type="$1"; shift
 | 
			
		||||
 | 
			
		||||
if [ ! -d "$(__cdist_object_dir "$object")" ]; then
 | 
			
		||||
   __cdist_exit_err "Object $object is missing."
 | 
			
		||||
fi  
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
finished="$(__cdist_object_code_finished "$object")"
 | 
			
		||||
code="$(__cdist_object_code "$object")"
 | 
			
		||||
require="$(__cdist_object_require "$object")"
 | 
			
		||||
 | 
			
		||||
code="$(__cdist_object_code "$object")-${__cdist_gencode_type}"
 | 
			
		||||
 | 
			
		||||
# Do nothing if our work has been done
 | 
			
		||||
if [ -f "$finished" ]; then
 | 
			
		||||
   exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo "Checking    code  for $object ..."
 | 
			
		||||
echo "Checking code-${__cdist_gencode_type} for $object ..."
 | 
			
		||||
 | 
			
		||||
if [ -f "$require" ]; then
 | 
			
		||||
   while read requirement; do
 | 
			
		||||
| 
						 | 
				
			
			@ -57,7 +57,7 @@ fi
 | 
			
		|||
if [ -e "$code" ]; then
 | 
			
		||||
   if [ -f "$code" ]; then
 | 
			
		||||
      if [ -x "$code" ]; then
 | 
			
		||||
         echo "Executing   code  for $object ..."
 | 
			
		||||
         echo "Executing code-${__cdist_gencode_type}  for $object ..."
 | 
			
		||||
         "$code"
 | 
			
		||||
         touch "$finished"
 | 
			
		||||
      else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue