forked from ungleich-public/cdist
Merge remote branch 'nico/master'
This commit is contained in:
commit
a6b88d323e
26 changed files with 1851 additions and 253 deletions
|
|
@ -24,12 +24,24 @@
|
|||
if [ -f "$__object/parameter/destination" ]; then
|
||||
destination="$(cat "$__object/parameter/destination")"
|
||||
else
|
||||
destination="$__object_id"
|
||||
destination="/$__object_id"
|
||||
fi
|
||||
|
||||
os="$(cat $__global/explorer/os)"
|
||||
|
||||
case "$os" in
|
||||
macosx)
|
||||
md5sum="md5"
|
||||
;;
|
||||
|
||||
*)
|
||||
md5sum="md5sum"
|
||||
;;
|
||||
esac
|
||||
|
||||
# No output if file does not exist - does definitely not match the md5sum :-)
|
||||
if [ -e "$destination" ]; then
|
||||
md5sum "$destination"
|
||||
$md5sum < "$destination"
|
||||
else
|
||||
echo "NO FILE NOT FOUND, NO CHECKSUM CALCULATED."
|
||||
echo "NO FILE FOUND, NO CHECKSUM CALCULATED."
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -40,20 +40,26 @@ if ! $(echo "$destination" | grep -q ^/); then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
case "$os" in
|
||||
macosx)
|
||||
md5sum="md5"
|
||||
;;
|
||||
|
||||
*)
|
||||
md5sum="md5sum"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Copy source if existing
|
||||
# FIXME: directory handling not supported - add recursive flag?
|
||||
if [ -f "$__object/parameter/source" ]; then
|
||||
source="$(cat "$__object/parameter/source")"
|
||||
|
||||
exec 3>&1
|
||||
exec 1>&2
|
||||
|
||||
set -x
|
||||
md5sum="$(md5sum "$source")"
|
||||
local_md5sum="$($md5sum < "$source")"
|
||||
remote_md5sum="$(cat "$__object/explorer/md5sum")"
|
||||
|
||||
# Is md5sum the right approach?
|
||||
if [ "$md5sum" != "$remote_md5sum" ]; then
|
||||
if [ "$local_md5sum" != "$remote_md5sum" ]; then
|
||||
# FIXME: This is ugly and hardcoded, replace after 1.0!
|
||||
# Probably a better aproach is to have the user configured
|
||||
# ~/.ssh/config to contain the right username
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue