forked from ungleich-public/cdist
cleanup bin/cdist-manifest-recursive-run
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
c8242ef7da
commit
4354c68405
1 changed files with 8 additions and 14 deletions
|
@ -30,16 +30,16 @@
|
|||
. cdist-config
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
__cdist_usage "<target host> <object_dir>"
|
||||
__cdist_usage "<target host> <object_base_dir>"
|
||||
fi
|
||||
|
||||
set -eu
|
||||
|
||||
__cdist_target_host="$1"; shift
|
||||
__cdist_object_dir="$1"; shift
|
||||
__cdist_object_base_dir="$1"; shift
|
||||
|
||||
# change to directory containing objects
|
||||
cd "$__cdist_object_dir"
|
||||
cd "$__cdist_object_base_dir"
|
||||
|
||||
# Loop until we do not create new objects anymore
|
||||
# which is equal to all objects have been run
|
||||
|
@ -51,16 +51,13 @@ while [ "$__cdist_object_created_new" = 1 ]; do
|
|||
__cdist_object_created_new=0
|
||||
|
||||
# find all objects (every object has the source recorded)
|
||||
find . -name "$__cdist_object_source" | \
|
||||
sed -e "s;$__cdist_object_source\$;;" \
|
||||
-e 's;^./;;' \
|
||||
> "$__cdist_tmp_file"
|
||||
__cdist_object_list . > "$__cdist_tmp_file"
|
||||
|
||||
# FIXME: DEBUG
|
||||
cat "$__cdist_tmp_file"
|
||||
|
||||
while read object; do
|
||||
if [ ! -f "${object}/$___cdist_name_object_finished" ]; then
|
||||
if [ ! -f "${object}/$__cdist_name_object_finished" ]; then
|
||||
echo "Working on object ${object} ..."
|
||||
|
||||
type=${object%%/*}
|
||||
|
@ -76,18 +73,15 @@ while [ "$__cdist_object_created_new" = 1 ]; do
|
|||
|
||||
# list of new objects
|
||||
cd "${__cdist_tmp_dir}"
|
||||
find . -name "$__cdist_object_source" | \
|
||||
sed -e "s;$__cdist_object_source\$;;" \
|
||||
-e 's;^./;;' \
|
||||
> "$__cdist_tmp_file"
|
||||
__cdist_object_list . > "$__cdist_tmp_file"
|
||||
|
||||
while read newobject; do
|
||||
if [ -e "$__cdist_object_dir/${newobject}" ]; then
|
||||
if [ -e "$__cdist_object_base_dir/${newobject}" ]; then
|
||||
__cdist_exit_err "${newobject} already exists, merge failed."
|
||||
else
|
||||
# Fine, merge back! FIXME: touch correct here?
|
||||
touch "${newobject}/$___cdist_name_object_finished"
|
||||
pax -r -w "$newobject" "$__cdist_object_dir"
|
||||
pax -r -w "$newobject" "$__cdist_object_base_dir"
|
||||
fi
|
||||
done < "$__cdist_tmp_file"
|
||||
|
||||
|
|
Loading…
Reference in a new issue