add support for __cdist_type_mydir to find dir of current type

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-02-07 17:50:25 +01:00
parent 43e6db264b
commit 3892f9e713
2 changed files with 8 additions and 1 deletions

View file

@ -31,13 +31,14 @@
: ${__cdist_name_explorer:=explorers}
: ${__cdist_name_host:=hosts}
: ${__cdist_name_init:=init}
: ${__cdist_name_manifest:=manifests}
: ${__cdist_name_object:=objects}
: ${__cdist_name_type:=types}
# Base
: ${__cdist_config:=/etc/cdist}
: ${__cdist_explorer_dir:=$__cdist_config/$__cdist_name_explorer}
: ${__cdist_manifest_dir:=$__cdist_config/manifests}
: ${__cdist_manifest_dir:=$__cdist_config/$__cdist_name_manifest}
: ${__cdist_manifest_init:=$__cdist_manifest_dir/$__cdist_name_init}
: ${__cdist_type_dir:=$__cdist_config/$__cdist_name_type}
@ -113,6 +114,11 @@ __cdist_cache_host()
echo "${__cdist_cache_hosts}/${__cdist_target_host}"
}
__cdist_type_mydir()
{
echo "${__cdist_type_dir}/${__cdist_type_current}"
}
__cdist_tmp_removal()
{
rm -rf "${__cdist_tmp_dir}"

View file

@ -33,6 +33,7 @@ set -eu
echo "I am $__cdist_myname and have been called with $@"
export __cdist_object_id="$1"; shift
export __cdist_type_current="$__cdist_myname"
echo "$__cdist_object_id" | grep -q "^${__cdist_sane_regexp}\$" || __cdist_usage "Provide sane id, please"