From 1bae761fa0126e954f0bddf30485ecc7f6b583cd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 8 Feb 2011 00:26:26 +0100 Subject: [PATCH] prepare next steps: stage four and five Signed-off-by: Nico Schottelius --- bin/cdist-build | 32 -------------------------------- bin/cdist-config | 1 + bin/cdist-deploy-to | 28 +++++++++++++++++++++++----- bin/cdist-manifest-recursive-run | 9 ++++----- bin/cdist-template.obsolete | 27 --------------------------- 5 files changed, 28 insertions(+), 69 deletions(-) delete mode 100755 bin/cdist-build delete mode 100755 bin/cdist-template.obsolete diff --git a/bin/cdist-build b/bin/cdist-build deleted file mode 100755 index f5d5b870..00000000 --- a/bin/cdist-build +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# -# 2010 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Build configuration and executable for host -# - -. cdist-config - -[ $# -eq 1 ] || __cdist_usage "" - -set -e - -. cdist-preprocess "$1" -. cdist-compile "$1" -. cdist-link "$1" diff --git a/bin/cdist-config b/bin/cdist-config index 5d308598..e2846021 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -28,6 +28,7 @@ # Names : ${__cdist_name_bin:=bin} : ${__cdist_name_cache:=cache} +: ${__cdist_name_code:=code} : ${__cdist_name_explorer:=explorers} : ${__cdist_name_host:=hosts} : ${__cdist_name_init:=init} diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index 7d766abd..ac22e26c 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -27,9 +27,27 @@ set -e -# Internal variables, usable by -export __cdist_target_host="$1" -export __cdist_source_host="$(cdist_explore_hostname)" +__cdist_target_host="$1" -. cdist-build "$__cdist_target_host" -. cdist-remote-exec "$__cdist_target_host" +tmp_exp="$__cdist_tmp_dir/$__cdist_name_explorer" +tmp_obj="$__cdist_tmp_dir/$__cdist_name_object" +tmp_code="$__cdist_tmp_dir/$__cdist_name_code" + +# See cdist-stages(7) +cdist-explorer-run "$__cdist_target_host" "$tmp_exp" +cdist-manifest-init "$__cdist_target_host" "$tmp_obj" +cdist-manifest-recursive-run "$__cdist_target_host" "$tmp_obj" + +# Create new cache - put into seperate script? +echo rm -rf "$(__cdist_cache_host)" +mkdir -p "$(__cdist_cache_host)" +mv "$tmp_exp" "$tmp_obj" "$(__cdist_cache_host)" + +# FIXME: continue below here +exit 1 + +cdist-code-gen "$(__cdist_cache_host)" > "$tmp_code" +cdist-target-exec "$__cdist_target_host" "$tmp_code" + +# Also save last code fragment +mv "$tmp_code" "$(__cdist_cache_host)" diff --git a/bin/cdist-manifest-recursive-run b/bin/cdist-manifest-recursive-run index 21a2c08e..5229f439 100755 --- a/bin/cdist-manifest-recursive-run +++ b/bin/cdist-manifest-recursive-run @@ -68,6 +68,8 @@ while [ "$__cdist_object_created_new" = 1 ]; do if [ -x "${manifest}" ]; then echo "Running manifest of type ${type} ..." + + # FIXME: use subdir in tmpdir? cdist-manifest-run "$__cdist_target_host" "${manifest}" "${__cdist_tmp_dir}" echo "Trying to merge... " @@ -83,10 +85,10 @@ while [ "$__cdist_object_created_new" = 1 ]; do if [ -e "$__cdist_object_dir/${newobject}" ]; then __cdist_exit_err "${newobject} already exists, merge failed." else - # Fine, merge back! + # Fine, merge back! FIXME: touch correct here? + touch "${object}/$__cdist_object_finished" pax -r -w "$newobject" "$__cdist_object_dir" fi - done < "$__cdist_tmp_file" # Always rerun the whole loop if we ran @@ -107,8 +109,6 @@ while [ "$__cdist_object_created_new" = 1 ]; do # # iterate over all new objects and copy each back? - # FIXME: cleanup tmp directory, if necessary! - else # Be nice, warn user if manifests exists, but is not executable if [ -f "${manifest}" ]; then @@ -116,7 +116,6 @@ while [ "$__cdist_object_created_new" = 1 ]; do fi fi - touch "${object}/$__cdist_object_finished" # At least one more run needed __cdist_object_created_new=1 diff --git a/bin/cdist-template.obsolete b/bin/cdist-template.obsolete deleted file mode 100755 index 5e72e29c..00000000 --- a/bin/cdist-template.obsolete +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# -# 2010 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Show template -# - -# fail, if variable is not set - IMPORTANT! -set -u - -. "$1"