|
|
|
@ -30,42 +30,6 @@ fi |
|
|
|
|
set -ue |
|
|
|
|
|
|
|
|
|
__cdist_target_host="$1"; shift |
|
|
|
|
__cdist_remote_src_dir="$1"; shift |
|
|
|
|
__cdist_remote_dst_dir="$1"; shift |
|
|
|
|
|
|
|
|
|
# Create remote destination directory |
|
|
|
|
ssh "${__cdist_remote_user}@${__cdist_target_host}" \ |
|
|
|
|
"mkdir -p \"${__cdist_remote_dst_dir}\"" |
|
|
|
|
|
|
|
|
|
# FIXME: enable -q as soon as the code is cleaned up |
|
|
|
|
cd "${__cdist_local_src_dir}" |
|
|
|
|
|
|
|
|
|
# Ensure there is at least one explorer |
|
|
|
|
num="$(ls -1 | wc -l)" |
|
|
|
|
if [ "$num" -lt 1 ]; then |
|
|
|
|
__cdist_exit_err "${__cdist_local_src_dir}: Contains no explorers" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# Execute all explorers |
|
|
|
|
for explorer in *; do |
|
|
|
|
if [ -f "$explorer" ]; then |
|
|
|
|
if [ ! -x "$explorer" ]; then |
|
|
|
|
echo "Explorer \"$explorer\" exists, but is not executable." |
|
|
|
|
continue |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# Execute explorers and save results in remote destination directory |
|
|
|
|
ssh "${__cdist_remote_user}@${__cdist_target_host}" \ |
|
|
|
|
"cd \"${__cdist_remote_src_dir}\" && \"./$explorer\" > \ |
|
|
|
|
\"${__cdist_remote_dst_dir}/${explorer}\"" "$@" |
|
|
|
|
else |
|
|
|
|
if [ -e "$explorer" ]; then |
|
|
|
|
echo "Explorer \"$explorer\" exists, but is not a file." |
|
|
|
|
continue |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
# Copy results back to us |
|
|
|
|
scp "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_remote_dst_dir}/*" \ |
|
|
|
|
"$__cdist_local_dst_dir" |
|
|
|
|
"${__cdist_remote_helper_dir}/cdist-explorer-remote-run" "$@" |
|
|
|
|