in theory, finish __file/gencode (with debug)

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-02-25 18:33:12 +01:00
parent 45429c2ca0
commit 918bb8bb5a

View file

@ -40,22 +40,43 @@ if ! $(echo "$destination" | grep -q ^/); then
exit 1 exit 1
fi fi
# FIXME: Add file copying part here # Copy source if existing
if [ -f "$__object/parameter/source" ]; then
source="$(cat "$__object/parameter/source")"
case "$type" in exec 3>&1
directory) exec 1>&2
echo mkdir \"$destination\"
;;
file) set -x
echo touch \"$destination\" md5sum="$(md5sum "$source")"
;; remote_md5sum="$(cat "$__object/explorer/md5sum")"
*) # Is md5sum the right approach?
echo "Unsupported type: \"$type\"" >&2 if [ "$md5sum" != "$remote_md5sum" ]; then
exit 1 # FIXME: This is ugly and hardcoded, replace after 1.0!
;; # Probably a better aproach is to have the user configured
esac # ~/.ssh/config to contain the right username
# Probably describe it in cdist-quickstart...
scp "$source" "root@${__target_host}:${destination}"
fi
# No source? Create empty file/dir
else
case "$type" in
directory)
echo mkdir \"$destination\"
;;
file)
echo touch \"$destination\"
;;
*)
echo "Unsupported type: \"$type\"" >&2
exit 1
;;
esac
fi
if [ -f "$__object/parameter/mode" ]; then if [ -f "$__object/parameter/mode" ]; then
mode="$(cat "$__object/parameters/mode")" mode="$(cat "$__object/parameters/mode")"