2010-09-19 12:13:13 +00:00
|
|
|
#!/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/>.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Print configuration directories - helper for all other scripts
|
|
|
|
#
|
|
|
|
|
2011-02-02 13:01:21 +00:00
|
|
|
: ${__cdist_config:=/etc/cdist}
|
|
|
|
: ${__cdist_manifest_dir:=$__cdist_config/manifests}
|
|
|
|
: ${__cdist_manifest_init:=$__cdist_manifest_dir/init}
|
2011-02-02 13:23:54 +00:00
|
|
|
|
2011-02-02 13:01:21 +00:00
|
|
|
: ${__cdist_type_dir:=$__cdist_config/types}
|
|
|
|
|
2011-02-02 13:23:54 +00:00
|
|
|
: ${__cdist_cache_dir:=$__cdist_config/cache}
|
|
|
|
: ${__cdist_cache_hosts:=$__cdist_cache_dir/hosts}
|
2011-02-02 13:55:28 +00:00
|
|
|
: ${__cdist_cache_bin:=$__cdist_cache_dir/bin}
|
2011-02-02 13:23:54 +00:00
|
|
|
|
2011-02-02 13:01:21 +00:00
|
|
|
|
|
|
|
# obsolete?: lib not needed, hosts replaced by manifests, modules by types
|
|
|
|
: ${__cdist_modules:=$__cdist_config/modules}
|
|
|
|
: ${__cdist_coredir:=$__cdist_config/core}
|
|
|
|
|
2010-09-19 12:13:13 +00:00
|
|
|
|
2010-09-30 17:09:21 +00:00
|
|
|
# create basedir + tempfile for direct usage
|
2011-02-02 13:01:21 +00:00
|
|
|
# FIXME: remove on exit
|
|
|
|
: ${__cdist_tmp_dir:=$(mktemp -d "/tmp/cdist.XXXXXXXXXXXX")}
|
|
|
|
: ${__cdist_tmp_file:=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX")}
|
2010-09-30 17:09:21 +00:00
|
|
|
|
2010-09-29 16:55:18 +00:00
|
|
|
################################################################################
|
|
|
|
# cconf standard vars prefixed with cdist
|
|
|
|
__cdist_pwd="$(pwd -P)"
|
|
|
|
__cdist_mydir="${0%/*}";
|
2010-09-30 17:09:21 +00:00
|
|
|
__cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)"
|
2010-09-29 16:55:18 +00:00
|
|
|
__cdist_myname=${0##*/};
|
2010-09-30 17:09:21 +00:00
|
|
|
__cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
|
2010-09-29 16:55:18 +00:00
|
|
|
|
2011-02-02 13:55:28 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Other constants
|
|
|
|
|
|
|
|
# Used for generating binaries in cdist-build-bin
|
|
|
|
__cdist_bin_prefix="__"
|
|
|
|
|
2011-02-02 14:02:26 +00:00
|
|
|
# Used for IDs
|
|
|
|
__cdist_sane_chars='[A-Za-z0-9_]'
|
|
|
|
|
2011-02-02 13:01:21 +00:00
|
|
|
################################################################################
|
|
|
|
# Function list
|
|
|
|
#
|
2010-09-29 16:55:18 +00:00
|
|
|
__cdist_debug_echo()
|
2010-09-25 10:36:30 +00:00
|
|
|
{
|
2011-02-02 13:01:21 +00:00
|
|
|
if [ "$__cdist_debug" ]; then
|
2010-09-30 17:09:21 +00:00
|
|
|
echo "Debug: $@"
|
|
|
|
fi
|
2010-09-25 10:36:30 +00:00
|
|
|
}
|
2010-09-19 12:30:36 +00:00
|
|
|
|
2011-02-02 13:55:28 +00:00
|
|
|
__cdist_exit_err()
|
2010-09-29 16:55:18 +00:00
|
|
|
{
|
2011-02-02 13:55:28 +00:00
|
|
|
echo "$@"
|
2010-09-29 16:55:18 +00:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2011-02-02 13:55:28 +00:00
|
|
|
__cdist_usage()
|
|
|
|
{
|
|
|
|
__cdist_exit_err "$__cdist_myname: $@"
|
|
|
|
}
|
|
|
|
|
2011-02-02 14:02:26 +00:00
|
|
|
__cdist_cache_host()
|
|
|
|
{
|
|
|
|
echo "${__cdist_cache_hosts}/${__cdist_target_host}"
|
|
|
|
}
|
|
|
|
|
2010-09-25 10:36:30 +00:00
|
|
|
|
|
|
|
#set -e
|
2010-09-20 00:30:16 +00:00
|
|
|
|
2010-12-01 19:10:42 +00:00
|
|
|
# load libraries so every program has them available - FIXME
|
2011-02-02 13:01:21 +00:00
|
|
|
## find "${__cdist_LIBDIR}" -type f > "${__cdist_TMP}"
|
2010-12-01 19:10:42 +00:00
|
|
|
## while read __cdist_lib; do
|
|
|
|
## __cdist_debug_echo "Loading $__cdist_lib ..."
|
|
|
|
## . "${__cdist_lib}"
|
2011-02-02 13:01:21 +00:00
|
|
|
## done < "${__cdist_TMP}"
|
2010-12-01 19:10:42 +00:00
|
|
|
##
|
2010-09-20 00:30:16 +00:00
|
|
|
|
2010-09-28 18:34:03 +00:00
|
|
|
# load modules, all parts => really
|
2011-02-02 13:01:21 +00:00
|
|
|
#find "${__cdist_MODULES}" -name manifest > "${__cdist_TMP}"
|
2010-09-20 00:30:16 +00:00
|
|
|
|
2010-09-25 10:36:30 +00:00
|
|
|
#set +e
|