another cleanup and almost running cdist-manifest-recursive-run
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
f4c53e800c
commit
3dacee432e
1 changed files with 35 additions and 33 deletions
|
@ -38,10 +38,17 @@ set -eu
|
|||
__cdist_output_dir="$1"; shift
|
||||
__cdist_object_dir="$1"; shift
|
||||
|
||||
__cdist_object_ran_all=0
|
||||
# change to directory containing objects
|
||||
cd "$__cdist_object_dir"
|
||||
|
||||
while [ "$__cdist_object_ran_all" = 0 ]; do
|
||||
cd "$__cdist_object_dir"
|
||||
# Loop until we do not create new objects anymore
|
||||
# which is equal to all objects have been run
|
||||
__cdist_object_created_new=1
|
||||
|
||||
|
||||
while [ "$__cdist_object_created_new" = 1 ]; do
|
||||
# assume we're done after this run
|
||||
__cdist_object_created_new=0
|
||||
|
||||
# find all objects (every object has the source recorded)
|
||||
find . -name "$__cdist_object_source" | \
|
||||
|
@ -49,43 +56,38 @@ while [ "$__cdist_object_ran_all" = 0 ]; do
|
|||
-e 's;^./;;' \
|
||||
> "$__cdist_tmp_file"
|
||||
|
||||
cat "$__cdist_tmp_file"
|
||||
|
||||
while read object; do
|
||||
if [ ! -f "${object}/$__cdist_object_finished" ]; then
|
||||
echo "Running object ${object} ..."
|
||||
echo "Merging stuff back..."
|
||||
|
||||
manifest="${object}/${__cdist_name_init}"
|
||||
if [ -x "${manifest}" ]; then
|
||||
cdist-manifest-run "${manifest}" "${__cdist_tmp_dir}"
|
||||
|
||||
echo "Merging stuff back..."
|
||||
# FIXME: continue here
|
||||
# tar, cp, pax?
|
||||
# - copy if not existing
|
||||
# fail (abort whole recursive run) if existing
|
||||
#
|
||||
# iterate over all new objects and copy each back?
|
||||
|
||||
else
|
||||
# Be nice, warn user if manifests exists, but is not executable
|
||||
if [ -f "${manifest}" ]; then
|
||||
echo "Warning ${manifest} is not executable"
|
||||
fi
|
||||
fi
|
||||
|
||||
touch "${object}/$__cdist_object_finished"
|
||||
|
||||
# At least one more run needed
|
||||
__cdist_object_created_new=1
|
||||
fi
|
||||
done < "$__cdist_tmp_file"
|
||||
|
||||
# # FIXME past 1.0: allow multi level ids (/example/id instead of example_id only)
|
||||
# # OUTER LOOP NEEDED IF GOING OVER ALL OBJECTS WITH FIND?
|
||||
# for type in *; do
|
||||
# cd "$__cdist_object_dir/$type"
|
||||
#
|
||||
# # find all objects (every object has the source recorded)
|
||||
# find . -name "$__cdist_object_source" > "$__cdist_tmp_file"
|
||||
#
|
||||
# while read object; do
|
||||
# echo "Running object ${type}/${object} ..."
|
||||
# done < "$__cdist_tmp_file"
|
||||
# done
|
||||
#
|
||||
# # FIXME: abort on real case only :-)
|
||||
# __cdist_object_ran_all=1
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
||||
# Ensure binaries exist and are up-to-date
|
||||
cdist-build-bin
|
||||
|
||||
# prepend our path, so all cdist tools come before other tools
|
||||
PATH="${__cdist_cache_bin}:$PATH"
|
||||
|
||||
# Force -x, so the user is aware the file is executed
|
||||
if [ ! -x "${__cdist_manifest_init}" ]; then
|
||||
__cdist_exit_err "${__cdist_manifest_init} needs to be executable."
|
||||
fi
|
||||
|
||||
mkdir -p "${__cdist_output_dir}"
|
||||
"${__cdist_manifest}"
|
||||
|
|
Loading…
Reference in a new issue