From 68b6f46a91b9ce6d777ca1328d37ad79c83bc209 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 Feb 2011 13:07:24 +0100 Subject: [PATCH 1/2] cleanup gencode Signed-off-by: Nico Schottelius --- conf/types/__file/gencode | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/conf/types/__file/gencode b/conf/types/__file/gencode index b95e52a5..9d585533 100755 --- a/conf/types/__file/gencode +++ b/conf/types/__file/gencode @@ -22,13 +22,14 @@ # example for typewrites later # -. cdist-config - -pwd -P >&2 -ls >&2 - type="$(cat type)" -path="$(cat destination)" + +# If destination was specified, do not use the id +if [ -f destination ]; then + destination="$(cat destination)" +else + destination="$1" +fi case "$type" in directory) @@ -43,7 +44,6 @@ case "$type" in echo "Unsupported type: \"$type\"" >&2 exit 1 ;; - esac if [ -f mode ]; then From 1f5fee5bad60bb51a8011b822eb867dc25eab48e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 Feb 2011 13:09:58 +0100 Subject: [PATCH 2/2] always prepend header in gencode Signed-off-by: Nico Schottelius --- bin/cdist-object-codegen | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/bin/cdist-object-codegen b/bin/cdist-object-codegen index 59d73674..6a8549f3 100755 --- a/bin/cdist-object-codegen +++ b/bin/cdist-object-codegen @@ -44,15 +44,11 @@ gencode="$(__cdist_type_gencode "$__cdist_type")" cd "$__cdist_object_dir" -# Call gencode of type with __cdist_object -if [ -x "$gencode" ]; then - # Prepend header to each script - cat << eof +cat << eof # -# Code imported from $gencode +# The following code is imported from output of $gencode # eof - __cdist_exec_fail_on_error "$gencode" "$__cdist_object_id" -fi +[ -x "$gencode" ] || __cdist_exec_fail_on_error "$gencode" "$__cdist_object_id"