theorethic working version of recursive run :-)

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-02-06 21:14:21 +01:00
parent 3dacee432e
commit 494ee906f2

View file

@ -29,13 +29,12 @@
. cdist-config . cdist-config
if [ $# -ne 2 ]; then if [ $# -ne 1 ]; then
__cdist_usage "<outdir> <object_dir>" __cdist_usage "<object_dir>"
fi fi
set -eu set -eu
__cdist_output_dir="$1"; shift
__cdist_object_dir="$1"; shift __cdist_object_dir="$1"; shift
# change to directory containing objects # change to directory containing objects
@ -66,14 +65,46 @@ while [ "$__cdist_object_created_new" = 1 ]; do
if [ -x "${manifest}" ]; then if [ -x "${manifest}" ]; then
cdist-manifest-run "${manifest}" "${__cdist_tmp_dir}" cdist-manifest-run "${manifest}" "${__cdist_tmp_dir}"
echo "Merging stuff back..." echo "Trying to merge... "
# list of new objects
cd "${__cdist_tmp_dir}"
find . -name "$__cdist_object_source" | \
sed -e "s;$__cdist_object_source\$;;" \
-e 's;^./;;' \
> "$__cdist_tmp_file"
while read newobject; do
if [ -e "$__cdist_object_dir/${newobject}" ]; then
echo FAIIIIIIIIL
exit 23
else
# Fine, merge back!
pax -r -w "$newobject" "$__cdist_object_dir"
fi
done < "$__cdist_tmp_file"
# Always rerun the whole loop if we ran
# a manifest of an object
break
# FIXME: continue here # FIXME: continue here
# tar, cp, pax? # tar, cp, pax, mv?
# mv/cp -n look good - posix?
# pax:
# pax -r -w -k could work, but -k does not raise an error if files
# are already existing
# - copy if not existing # - copy if not existing
# fail (abort whole recursive run) if existing # fail (abort whole recursive run) if existing
# #
# iterate over all new objects and copy each back? # iterate over all new objects and copy each back?
# FIXME: cleanup tmp directory, if necessary!
else else
# Be nice, warn user if manifests exists, but is not executable # Be nice, warn user if manifests exists, but is not executable
if [ -f "${manifest}" ]; then if [ -f "${manifest}" ]; then