split: cdist-build-host-cconfig to cdist-manifest-init and cdist-manifest-run

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-02-02 19:15:53 +01:00
parent 2d54c04f8a
commit 489639f8e0
2 changed files with 35 additions and 7 deletions

29
bin/cdist-manifest-init Executable file
View file

@ -0,0 +1,29 @@
#!/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/>.
#
#
# Let's build a cconfig tree from a configuration
# And save it into the cache tree
#
. cdist-config
[ "${__cdist_target_host}" ] || __cdist_usage "Need \$__cdist_target_host setup"
cdist-manifest-run "$(__cdist_cache_host)" "${__cdist_manifest_init}"

View file

@ -24,11 +24,15 @@
. cdist-config . cdist-config
[ "${__cdist_target_host}" ] || __cdist_usage "Need \$__cdist_target_host setup" if [ $# -ne 2 ]; then
[ "${__cdist_output_dir}" ] || __cdist_usage "Need \$__cdist_output_dir setup" __cdist_usage "<outdir> <manifest>"
fi
set -au set -au
__cdist_output_dir="$1"; shift
__cdist_manifest="$1"; shift
# prepend our path, so all cdist tools come before other tools # prepend our path, so all cdist tools come before other tools
PATH="${__cdist_cache_bin}:$PATH" PATH="${__cdist_cache_bin}:$PATH"
@ -37,10 +41,5 @@ if [ ! -x "${__cdist_manifest_init}" ]; then
__cdist_exit_err "${__cdist_manifest_init} needs to be executable." __cdist_exit_err "${__cdist_manifest_init} needs to be executable."
fi fi
# create output dir ??
mkdir -p "$(__cdist_output_dir)" mkdir -p "$(__cdist_output_dir)"
# Create output / take manifest as argument?
"${__cdist_manifest_init}" "${__cdist_manifest_init}"
echo "Finished tree generation, have a look at ${__cdist_output_dir}."