forked from ungleich-public/cdist
replace some hardcoded values with dynamic generated ones
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
f8a150779e
commit
691766b27e
2 changed files with 40 additions and 24 deletions
|
@ -28,13 +28,9 @@
|
|||
set -au
|
||||
|
||||
# all types cdist is aware of
|
||||
export cdist_types="file service user"
|
||||
export __cdist_types="file service user"
|
||||
|
||||
# the file that contains mapping from hosts to types
|
||||
# we will execute this later -- call this MANIFEST?
|
||||
cdist_config_base="./EXAMPLE_MANIFEST"
|
||||
|
||||
cdist_tree_wrapper="./cdist_tree_wrapper"
|
||||
cdist_tree_wrapper="cdist_tree_wrapper"
|
||||
|
||||
# used to build the tree and other stuff
|
||||
tmpdir=/tmp/cdist-test-hardcoded
|
||||
|
@ -61,7 +57,7 @@ mkdir -p "${cdist_bindir}"
|
|||
(
|
||||
set -e
|
||||
cd "${cdist_bindir}"
|
||||
for bin in $cdist_types; do
|
||||
for bin in $__core_types; do
|
||||
ln -s "${cdist_tree_wrapper_abs}" "${cdist_type_prefix}${bin}"
|
||||
done
|
||||
)
|
||||
|
@ -77,8 +73,8 @@ PATH="${cdist_bindir}:$PATH"
|
|||
mkdir -p "${cdist_confdir}"
|
||||
|
||||
# force -x, so the user is aware the file is executed
|
||||
if [ -x "${cdist_config_base}" ]; then
|
||||
"${cdist_config_base}"
|
||||
if [ -x "${__cdist_manifest_init}" ]; then
|
||||
"${__cdist_manifest_init}"
|
||||
else
|
||||
echo Throw some error, as you forgot to +x it.
|
||||
exit 1
|
||||
|
|
|
@ -21,16 +21,22 @@
|
|||
# Print configuration directories - helper for all other scripts
|
||||
#
|
||||
|
||||
: ${CDIST_CONFIG:=/etc/cdist}
|
||||
: ${CDIST_COREDIR:=$CDIST_CONFIG/core}
|
||||
: ${CDIST_LIBDIR:=$CDIST_CONFIG/lib}
|
||||
: ${CDIST_HOSTS:=$CDIST_CONFIG/hosts}
|
||||
: ${CDIST_MODULES:=$CDIST_CONFIG/modules}
|
||||
: ${__cdist_config:=/etc/cdist}
|
||||
: ${__cdist_manifest_dir:=$__cdist_config/manifests}
|
||||
: ${__cdist_manifest_init:=$__cdist_manifest_dir/init}
|
||||
: ${__cdist_type_dir:=$__cdist_config/types}
|
||||
|
||||
|
||||
# obsolete?: lib not needed, hosts replaced by manifests, modules by types
|
||||
: ${__cdist_hosts:=$__cdist_config/hosts}
|
||||
: ${__cdist_modules:=$__cdist_config/modules}
|
||||
: ${__cdist_coredir:=$__cdist_config/core}
|
||||
|
||||
|
||||
# create basedir + tempfile for direct usage
|
||||
: ${CDIST_TMPBASEDIR:=/tmp}
|
||||
: ${CDIST_TMPDIR:=$(mktemp -d "$CDIST_TMPBASEDIR/cdist.XXXXXXXXXXXX")}
|
||||
: ${CDIST_TMP:=$(mktemp "$CDIST_TMPDIR/cdist.XXXXXXXXXXXX")}
|
||||
# FIXME: remove on exit
|
||||
: ${__cdist_tmp_dir:=$(mktemp -d "/tmp/cdist.XXXXXXXXXXXX")}
|
||||
: ${__cdist_tmp_file:=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX")}
|
||||
|
||||
################################################################################
|
||||
# cconf standard vars prefixed with cdist
|
||||
|
@ -41,9 +47,23 @@ __cdist_myname=${0##*/};
|
|||
__cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
|
||||
|
||||
|
||||
################################################################################
|
||||
# Generate list of types
|
||||
#
|
||||
|
||||
# FIXME: ignore error?
|
||||
cd "$__cdist_type_dir"
|
||||
for __cdist_type in ${__cdist_type_dir}/*; do
|
||||
__cdist_types="$__cdist_types $__cdist_type"
|
||||
done
|
||||
cd "$__cdist_abs_mydir"
|
||||
|
||||
################################################################################
|
||||
# Function list
|
||||
#
|
||||
__cdist_debug_echo()
|
||||
{
|
||||
if [ "$CDIST_DEBUG" ]; then
|
||||
if [ "$__cdist_debug" ]; then
|
||||
echo "Debug: $@"
|
||||
fi
|
||||
}
|
||||
|
@ -58,20 +78,20 @@ __cdist_usage()
|
|||
#set -e
|
||||
|
||||
# load libraries so every program has them available - FIXME
|
||||
## find "${CDIST_LIBDIR}" -type f > "${CDIST_TMP}"
|
||||
## find "${__cdist_LIBDIR}" -type f > "${__cdist_TMP}"
|
||||
## while read __cdist_lib; do
|
||||
## __cdist_debug_echo "Loading $__cdist_lib ..."
|
||||
## . "${__cdist_lib}"
|
||||
## done < "${CDIST_TMP}"
|
||||
## done < "${__cdist_TMP}"
|
||||
##
|
||||
|
||||
# load modules, all parts => really
|
||||
#find "${CDIST_MODULES}" -name manifest > "${CDIST_TMP}"
|
||||
#find "${__cdist_MODULES}" -name manifest > "${__cdist_TMP}"
|
||||
|
||||
#set +e
|
||||
|
||||
#echo $CDIST_CONFIG
|
||||
#echo $__cdist_CONFIG
|
||||
# FIXME: here or somewhere else? other parts may reuse tmp
|
||||
: > "$CDIST_TMP"
|
||||
#rm -f "$CDIST_TMP"
|
||||
: > "$__cdist_TMP"
|
||||
#rm -f "$__cdist_TMP"
|
||||
#__cdist_cur="$(pwd -P)"
|
||||
|
|
Loading…
Reference in a new issue