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:
Nico Schottelius 2011-03-10 13:31:00 +01:00
parent 4fdfac292b
commit 637163d4af
2 changed files with 16 additions and 10 deletions

View File

@ -41,7 +41,11 @@ esac
# No output if file does not exist - does definitely not match the md5sum :-)
if [ -e "$destination" ]; then
if [ -f "$destination" ]; then
$md5sum < "$destination"
else
echo "NO REGULAR FILE"
fi
else
echo "NO FILE FOUND, NO CHECKSUM CALCULATED."
fi

View File

@ -55,6 +55,7 @@ esac
if [ -f "$__object/parameter/source" ]; then
source="$(cat "$__object/parameter/source")"
if [ -f "$source" ]; then
local_md5sum="$($md5sum < "$source")"
remote_md5sum="$(cat "$__object/explorer/md5sum")"
@ -66,6 +67,7 @@ if [ -f "$__object/parameter/source" ]; then
# Probably describe it in cdist-quickstart...
scp "$source" "root@${__target_host}:${destination}"
fi
fi
# No source? Create empty file/dir
else
case "$type" in