From 709271fd2eb616ff221b7ba5b8d34b52e759ec96 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Feb 2011 19:42:10 +0100 Subject: [PATCH] cleanup type __file, it can use cat from current dir directly now Signed-off-by: Nico Schottelius --- conf/manifests/init | 2 -- conf/types/__file/gencode | 20 ++++++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/conf/manifests/init b/conf/manifests/init index 9e8ed4bb..2923ba88 100755 --- a/conf/manifests/init +++ b/conf/manifests/init @@ -2,8 +2,6 @@ # This is a sample manifest, but used in real world # -set -x - # All ikqs get a sample file case "$__cdist_target_host" in ikq*|localhost) diff --git a/conf/types/__file/gencode b/conf/types/__file/gencode index caa6bb14..904a871f 100755 --- a/conf/types/__file/gencode +++ b/conf/types/__file/gencode @@ -18,25 +18,33 @@ # along with cdist. If not, see . # # +# __file is a very basic type and should be able to be used as an +# example for typewrites later +# +. cdist-config -case "$__arg_type" in +type="$(cat type)" +mode="$(cat mode)" +path="$(cat path)" + +case "$type" in directory) - echo mkdir \"$__arg_path\" + echo mkdir \"$path\" ;; file) - echo touch \"$__arg_path\" + echo touch \"$path\" ;; *) - echo "Unsupported type: $__arg_type" >&2 + echo "Unsupported type: \"$type\"" >&2 exit 1 ;; esac -if [ "$__arg_mode" ]; then - echo chmod \"$__arg_mode\" \"$__arg_path\" +if [ "$mode" ]; then + echo chmod \"$mode\" \"$path\" fi