only md5sum if file is a regular file (not a directory)
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								4fdfac292b
							
						
					
				
			
			
				commit
				
					
						637163d4af
					
				
			
		
					 2 changed files with 16 additions and 10 deletions
				
			
		| 
						 | 
					@ -41,7 +41,11 @@ esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# No output if file does not exist - does definitely not match the md5sum :-)
 | 
					# No output if file does not exist - does definitely not match the md5sum :-)
 | 
				
			||||||
if [ -e "$destination" ]; then
 | 
					if [ -e "$destination" ]; then
 | 
				
			||||||
   $md5sum < "$destination"
 | 
					   if [ -f  "$destination" ]; then
 | 
				
			||||||
 | 
					      $md5sum < "$destination"
 | 
				
			||||||
 | 
					   else
 | 
				
			||||||
 | 
					      echo "NO REGULAR FILE"
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
   echo "NO FILE FOUND, NO CHECKSUM CALCULATED."
 | 
					   echo "NO FILE FOUND, NO CHECKSUM CALCULATED."
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -55,16 +55,18 @@ esac
 | 
				
			||||||
if [ -f "$__object/parameter/source" ]; then
 | 
					if [ -f "$__object/parameter/source" ]; then
 | 
				
			||||||
   source="$(cat "$__object/parameter/source")"
 | 
					   source="$(cat "$__object/parameter/source")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   local_md5sum="$($md5sum < "$source")"
 | 
					   if [ -f "$source" ]; then
 | 
				
			||||||
   remote_md5sum="$(cat "$__object/explorer/md5sum")"
 | 
					      local_md5sum="$($md5sum < "$source")"
 | 
				
			||||||
 | 
					      remote_md5sum="$(cat "$__object/explorer/md5sum")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   # Is md5sum the right approach?
 | 
					      # Is md5sum the right approach?
 | 
				
			||||||
   if [ "$local_md5sum" != "$remote_md5sum" ]; then
 | 
					      if [ "$local_md5sum" != "$remote_md5sum" ]; then
 | 
				
			||||||
      # FIXME: This is ugly and hardcoded, replace after 1.0!
 | 
					         # FIXME: This is ugly and hardcoded, replace after 1.0!
 | 
				
			||||||
      # Probably a better aproach is to have the user configured
 | 
					         # Probably a better aproach is to have the user configured
 | 
				
			||||||
      # ~/.ssh/config to contain the right username
 | 
					         # ~/.ssh/config to contain the right username
 | 
				
			||||||
      # Probably describe it in cdist-quickstart...
 | 
					         # Probably describe it in cdist-quickstart...
 | 
				
			||||||
      scp "$source" "root@${__target_host}:${destination}"
 | 
					         scp "$source" "root@${__target_host}:${destination}"
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
   fi
 | 
					   fi
 | 
				
			||||||
# No source? Create empty file/dir
 | 
					# No source? Create empty file/dir
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue