prepare next steps: stage four and five

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-02-08 00:26:26 +01:00
parent 2a65be81cf
commit 1bae761fa0
5 changed files with 28 additions and 69 deletions

View file

@ -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 <http://www.gnu.org/licenses/>.
#
#
# Build configuration and executable for host
#
. cdist-config
[ $# -eq 1 ] || __cdist_usage "<target host>"
set -e
. cdist-preprocess "$1"
. cdist-compile "$1"
. cdist-link "$1"

View file

@ -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}

View file

@ -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)"

View file

@ -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

View file

@ -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 <http://www.gnu.org/licenses/>.
#
#
# Show template
#
# fail, if variable is not set - IMPORTANT!
set -u
. "$1"