| 
									
										
										
										
											2010-09-19 14:13:13 +02:00
										 |  |  | #!/bin/sh | 
					
						
							|  |  |  | # | 
					
						
							| 
									
										
										
										
											2011-02-17 17:46:18 +01:00
										 |  |  | # 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) | 
					
						
							| 
									
										
										
										
											2010-09-19 14:13:13 +02:00
										 |  |  | # | 
					
						
							|  |  |  | # 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/>. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-21 14:11:24 +01:00
										 |  |  | __cdist_version="1.3.2" | 
					
						
							| 
									
										
										
										
											2011-03-11 19:25:55 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-11 19:09:36 +01:00
										 |  |  | # Fail if something bogus is going on | 
					
						
							| 
									
										
										
										
											2011-02-24 14:28:29 +01:00
										 |  |  | set -u | 
					
						
							| 
									
										
										
										
											2011-02-05 19:32:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-03 14:49:48 +01:00
										 |  |  | ################################################################################ | 
					
						
							|  |  |  | # cconf standard vars prefixed with cdist | 
					
						
							| 
									
										
										
										
											2011-03-04 02:08:05 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-03 14:49:48 +01:00
										 |  |  | __cdist_pwd="$(pwd -P)" | 
					
						
							|  |  |  | __cdist_mydir="${0%/*}"; | 
					
						
							|  |  |  | __cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)" | 
					
						
							|  |  |  | __cdist_myname=${0##*/}; | 
					
						
							|  |  |  | __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ################################################################################ | 
					
						
							|  |  |  | # Names / Constants | 
					
						
							|  |  |  | # | 
					
						
							| 
									
										
										
										
											2011-02-25 01:48:18 +01:00
										 |  |  | # Most values can be overriden from outside, so you can | 
					
						
							| 
									
										
										
										
											2011-02-02 21:49:01 +01:00
										 |  |  | # customise paths as you like (for distributors, geeks and hackers) | 
					
						
							| 
									
										
										
										
											2011-03-03 14:49:48 +01:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2011-02-02 14:23:54 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-05 19:41:47 +01:00
										 |  |  | : ${__cdist_name_bin:=bin} | 
					
						
							| 
									
										
										
										
											2011-02-08 00:26:26 +01:00
										 |  |  | : ${__cdist_name_code:=code} | 
					
						
							| 
									
										
										
										
											2011-03-18 01:31:30 +01:00
										 |  |  | : ${__cdist_name_code_finished:=.codedone} | 
					
						
							| 
									
										
										
										
											2011-02-25 00:14:26 +01:00
										 |  |  | : ${__cdist_name_conf_dir:=conf} | 
					
						
							| 
									
										
										
										
											2011-03-21 16:18:04 +01:00
										 |  |  | : ${__cdist_name_dot_cdist:=.cdist} | 
					
						
							| 
									
										
										
										
											2011-02-24 21:32:01 +01:00
										 |  |  | : ${__cdist_name_explorer:=explorer} | 
					
						
							| 
									
										
										
										
											2011-02-14 11:28:14 +01:00
										 |  |  | : ${__cdist_name_gencode:=gencode} | 
					
						
							| 
									
										
										
										
											2011-03-19 22:19:44 +01:00
										 |  |  | : ${__cdist_name_gencode_local:=local} | 
					
						
							|  |  |  | : ${__cdist_name_gencode_remote:=remote} | 
					
						
							| 
									
										
										
										
											2011-03-03 10:37:11 +01:00
										 |  |  | : ${__cdist_name_global:=global} | 
					
						
							| 
									
										
										
										
											2011-02-24 21:32:01 +01:00
										 |  |  | : ${__cdist_name_host:=host} | 
					
						
							| 
									
										
										
										
											2011-02-05 19:41:47 +01:00
										 |  |  | : ${__cdist_name_init:=init} | 
					
						
							| 
									
										
										
										
											2011-02-24 14:47:52 +01:00
										 |  |  | : ${__cdist_name_manifest:=manifest} | 
					
						
							| 
									
										
										
										
											2011-02-24 15:34:17 +01:00
										 |  |  | : ${__cdist_name_object:=object} | 
					
						
							| 
									
										
										
										
											2011-02-25 00:14:26 +01:00
										 |  |  | : ${__cdist_name_object_finished:=.done} | 
					
						
							| 
									
										
										
										
											2011-02-24 15:34:17 +01:00
										 |  |  | : ${__cdist_name_object_id:=object_id} | 
					
						
							| 
									
										
										
										
											2011-02-25 00:14:26 +01:00
										 |  |  | : ${__cdist_name_object_source:=.source} | 
					
						
							|  |  |  | : ${__cdist_name_out_dir:=out} | 
					
						
							| 
									
										
										
										
											2011-02-24 21:32:01 +01:00
										 |  |  | : ${__cdist_name_parameter:=parameter} | 
					
						
							|  |  |  | : ${__cdist_name_parameter_required:=required} | 
					
						
							|  |  |  | : ${__cdist_name_parameter_optional:=optional} | 
					
						
							| 
									
										
										
										
											2011-03-16 15:49:28 +01:00
										 |  |  | : ${__cdist_name_require:=require} | 
					
						
							| 
									
										
										
										
											2011-03-09 22:09:44 +01:00
										 |  |  | : ${__cdist_name_singleton:=singleton} | 
					
						
							| 
									
										
										
										
											2011-02-24 15:05:31 +01:00
										 |  |  | : ${__cdist_name_target_host:=target_host} | 
					
						
							| 
									
										
										
										
											2011-03-20 02:44:31 +01:00
										 |  |  | : ${__cdist_name_target_user:=target_user} | 
					
						
							| 
									
										
										
										
											2011-02-24 21:32:01 +01:00
										 |  |  | : ${__cdist_name_type:=type} | 
					
						
							| 
									
										
										
										
											2011-02-23 18:40:58 +01:00
										 |  |  | : ${__cdist_name_type_bin:=type_bin} | 
					
						
							| 
									
										
										
										
											2011-02-24 21:32:01 +01:00
										 |  |  | : ${__cdist_name_type_explorer:=type_explorer} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-10 17:19:25 +01:00
										 |  |  | # Used for IDs: Allow everything not starting with - and . | 
					
						
							| 
									
										
										
										
											2011-03-10 17:25:24 +01:00
										 |  |  | : ${__cdist_sane_regexp:=[^-\.].*} | 
					
						
							| 
									
										
										
										
											2011-02-17 09:17:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-03 14:49:48 +01:00
										 |  |  | # Default remote user | 
					
						
							|  |  |  | : ${__cdist_remote_user:=root} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ################################################################################ | 
					
						
							|  |  |  | # Exported variable names (usable for non core | 
					
						
							|  |  |  | # | 
					
						
							| 
									
										
										
										
											2011-02-24 14:24:47 +01:00
										 |  |  | : ${__cdist_name_var_explorer:=__$__cdist_name_explorer} | 
					
						
							| 
									
										
										
										
											2011-02-24 21:32:01 +01:00
										 |  |  | : ${__cdist_name_var_type_explorer:=__$__cdist_name_type_explorer} | 
					
						
							| 
									
										
										
										
											2011-03-03 10:37:11 +01:00
										 |  |  | : ${__cdist_name_var_global:=__$__cdist_name_global} | 
					
						
							| 
									
										
										
										
											2011-02-24 21:32:01 +01:00
										 |  |  | : ${__cdist_name_var_manifest:=__$__cdist_name_manifest} | 
					
						
							| 
									
										
										
										
											2011-02-24 15:05:31 +01:00
										 |  |  | : ${__cdist_name_var_target_host:=__$__cdist_name_target_host} | 
					
						
							| 
									
										
										
										
											2011-03-20 02:44:31 +01:00
										 |  |  | : ${__cdist_name_var_target_user:=__$__cdist_name_target_user} | 
					
						
							| 
									
										
										
										
											2011-02-24 15:34:17 +01:00
										 |  |  | : ${__cdist_name_var_object:=__$__cdist_name_object} | 
					
						
							|  |  |  | : ${__cdist_name_var_object_id:=__$__cdist_name_object_id} | 
					
						
							| 
									
										
										
										
											2011-02-25 18:42:38 +01:00
										 |  |  | : ${__cdist_name_var_type:=__$__cdist_name_type} | 
					
						
							| 
									
										
										
										
											2011-02-17 09:17:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-16 20:12:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-03 15:27:51 +01:00
										 |  |  | ################################################################################ | 
					
						
							|  |  |  | # Tempfiles | 
					
						
							|  |  |  | #  | 
					
						
							|  |  |  | __cdist_tmp_dir=$(mktemp -d "/tmp/cdist.XXXXXXXXXXXX") | 
					
						
							|  |  |  | __cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-03 14:49:48 +01:00
										 |  |  | ################################################################################ | 
					
						
							| 
									
										
										
										
											2011-03-03 10:37:11 +01:00
										 |  |  | # Local Base | 
					
						
							| 
									
										
										
										
											2011-03-03 14:49:48 +01:00
										 |  |  | #  | 
					
						
							| 
									
										
										
										
											2011-03-03 15:27:51 +01:00
										 |  |  | : ${__cdist_local_base_dir:=$__cdist_tmp_dir} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : ${__cdist_conf_dir:="$(cd "$__cdist_abs_mydir/../conf" && pwd -P)"} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-23 19:01:29 +01:00
										 |  |  | : ${__cdist_explorer_dir:=$__cdist_conf_dir/$__cdist_name_explorer} | 
					
						
							| 
									
										
										
										
											2011-02-24 21:32:01 +01:00
										 |  |  | : ${__cdist_manifest_dir:=$__cdist_conf_dir/$__cdist_name_manifest} | 
					
						
							| 
									
										
										
										
											2011-02-05 19:41:47 +01:00
										 |  |  | : ${__cdist_manifest_init:=$__cdist_manifest_dir/$__cdist_name_init} | 
					
						
							| 
									
										
										
										
											2011-02-23 19:01:29 +01:00
										 |  |  | : ${__cdist_type_dir:=$__cdist_conf_dir/$__cdist_name_type} | 
					
						
							| 
									
										
										
										
											2011-02-02 14:01:21 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-03 14:49:48 +01:00
										 |  |  | ################################################################################ | 
					
						
							|  |  |  | # Local output | 
					
						
							|  |  |  | #  | 
					
						
							| 
									
										
										
										
											2011-03-03 10:37:11 +01:00
										 |  |  | : ${__cdist_out_dir:=$__cdist_local_base_dir/$__cdist_name_out_dir} | 
					
						
							|  |  |  | : ${__cdist_out_explorer_dir:=$__cdist_out_dir/$__cdist_name_explorer} | 
					
						
							|  |  |  | : ${__cdist_out_object_dir:=$__cdist_out_dir/$__cdist_name_object} | 
					
						
							|  |  |  | : ${__cdist_out_type_bin_dir:=$__cdist_out_dir/$__cdist_name_type_bin} | 
					
						
							| 
									
										
										
										
											2011-02-22 20:40:54 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-03 14:49:48 +01:00
										 |  |  | ################################################################################ | 
					
						
							| 
									
										
										
										
											2011-02-23 16:19:41 +01:00
										 |  |  | # Remote base | 
					
						
							| 
									
										
										
										
											2011-03-03 14:49:48 +01:00
										 |  |  | #  | 
					
						
							| 
									
										
										
										
											2011-02-04 14:38:17 +01:00
										 |  |  | : ${__cdist_remote_base_dir:=/var/lib/cdist} | 
					
						
							| 
									
										
										
										
											2011-03-03 15:27:51 +01:00
										 |  |  | : ${__cdist_remote_bin_dir:=$__cdist_remote_base_dir/$__cdist_name_bin} | 
					
						
							| 
									
										
										
										
											2011-02-23 16:19:41 +01:00
										 |  |  | : ${__cdist_remote_conf_dir:=$__cdist_remote_base_dir/$__cdist_name_conf_dir} | 
					
						
							| 
									
										
										
										
											2011-03-03 15:27:51 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-23 16:19:41 +01:00
										 |  |  | : ${__cdist_remote_explorer_dir:=$__cdist_remote_conf_dir/$__cdist_name_explorer} | 
					
						
							| 
									
										
										
										
											2011-02-24 16:33:08 +01:00
										 |  |  | : ${__cdist_remote_type_dir:=$__cdist_remote_conf_dir/$__cdist_name_type} | 
					
						
							| 
									
										
										
										
											2011-02-23 16:19:41 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-03 14:49:48 +01:00
										 |  |  | ################################################################################ | 
					
						
							|  |  |  | # Remote output | 
					
						
							|  |  |  | # | 
					
						
							| 
									
										
										
										
											2011-02-23 16:19:41 +01:00
										 |  |  | : ${__cdist_remote_out_dir:=$__cdist_remote_base_dir/$__cdist_name_out_dir} | 
					
						
							|  |  |  | : ${__cdist_remote_out_explorer_dir:=$__cdist_remote_out_dir/$__cdist_name_explorer} | 
					
						
							| 
									
										
										
										
											2011-02-24 21:24:21 +01:00
										 |  |  | : ${__cdist_remote_out_object_base_dir:=$__cdist_remote_out_dir/$__cdist_name_object} | 
					
						
							| 
									
										
										
										
											2011-02-04 14:38:17 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-02 14:01:21 +01:00
										 |  |  | ################################################################################ | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | # Internal functions | 
					
						
							| 
									
										
										
										
											2011-02-02 14:01:21 +01:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2010-09-29 18:55:18 +02:00
										 |  |  | __cdist_debug_echo() | 
					
						
							| 
									
										
										
										
											2010-09-25 12:36:30 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-02-02 14:01:21 +01:00
										 |  |  |    if [ "$__cdist_debug" ]; then | 
					
						
							| 
									
										
										
										
											2010-09-30 19:09:21 +02:00
										 |  |  |       echo "Debug: $@" | 
					
						
							|  |  |  |    fi | 
					
						
							| 
									
										
										
										
											2010-09-25 12:36:30 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2010-09-19 14:30:36 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | __cdist_exec_fail_on_error() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |    sh -e "$@" | 
					
						
							|  |  |  |    [ "$?" -eq 0 ] || __cdist_exit_err "Error: $1 exited non-zero." | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-02 14:55:28 +01:00
										 |  |  | __cdist_exit_err() | 
					
						
							| 
									
										
										
										
											2010-09-29 18:55:18 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-02-17 16:07:07 +01:00
										 |  |  |    echo "$@" >&2 | 
					
						
							| 
									
										
										
										
											2010-09-29 18:55:18 +02:00
										 |  |  |    exit 1 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-02 14:55:28 +01:00
										 |  |  | __cdist_usage() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |    __cdist_exit_err "$__cdist_myname: $@" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-03 09:43:04 +01:00
										 |  |  | __cdist_init_deploy() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-03 09:47:02 +01:00
										 |  |  |    echo "Creating clean directory structure ..." | 
					
						
							| 
									
										
										
										
											2011-03-03 09:43:04 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |    # Ensure there is no old stuff, neither local nor remote | 
					
						
							|  |  |  |    rm -rf "$__cdist_local_base_dir" | 
					
						
							|  |  |  |    ssh "${__cdist_remote_user}@$1" "rm -rf ${__cdist_remote_base_dir}" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    # Init base | 
					
						
							|  |  |  |    mkdir -p "$__cdist_local_base_dir" | 
					
						
							|  |  |  |    ssh "${__cdist_remote_user}@$1" "mkdir -p ${__cdist_remote_base_dir}" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    # Link configuration source directory - consistent with remote | 
					
						
							|  |  |  |    ln -sf "$__cdist_conf_dir" "$__cdist_local_base_dir/$__cdist_name_conf_dir" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | ################################################################################ | 
					
						
							|  |  |  | # Object | 
					
						
							|  |  |  | # | 
					
						
							| 
									
										
										
										
											2011-02-24 17:28:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | __cdist_object_code() | 
					
						
							| 
									
										
										
										
											2011-02-07 17:50:25 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    echo "$(__cdist_object_dir "$1")/${__cdist_name_code}" | 
					
						
							| 
									
										
										
										
											2011-02-07 17:50:25 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | __cdist_object_code_finished() | 
					
						
							| 
									
										
										
										
											2011-02-23 00:21:11 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    echo "$(__cdist_object_dir "$1")/${__cdist_name_code_finished}" | 
					
						
							| 
									
										
										
										
											2011-02-23 00:21:11 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:19:05 +01:00
										 |  |  | __cdist_object_dir() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |    __cdist_object_dir="${__cdist_out_object_dir}/$1/${__cdist_name_dot_cdist}" | 
					
						
							|  |  |  |    echo "$__cdist_object_dir" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | __cdist_object_id_from_object() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |    echo "${1#*/}" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | # Find objects, remove ./ and /MARKER | 
					
						
							|  |  |  | __cdist_object_list() | 
					
						
							| 
									
										
										
										
											2011-02-24 16:33:08 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    local basedir="$1"; shift | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    # Use subshell to prevent changing cwd in program | 
					
						
							|  |  |  |    ( | 
					
						
							|  |  |  |       cd "${basedir}" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       find . -name "$__cdist_name_object_source" |    \ | 
					
						
							|  |  |  |          sed -e 's;^./;;' -e "s;/${__cdist_name_object_source}\$;;" | 
					
						
							|  |  |  |    ) | 
					
						
							| 
									
										
										
										
											2011-02-24 16:33:08 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-16 19:44:04 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | __cdist_object_parameter_dir() | 
					
						
							| 
									
										
										
										
											2011-02-16 23:04:02 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    echo "$(__cdist_object_dir "$1")/${__cdist_name_parameter}" | 
					
						
							| 
									
										
										
										
											2011-03-07 23:55:46 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2011-02-16 23:04:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | __cdist_object_require() | 
					
						
							| 
									
										
										
										
											2011-03-10 17:41:08 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    echo "$(__cdist_object_dir "$1")/${__cdist_name_require}" | 
					
						
							| 
									
										
										
										
											2011-03-10 17:41:08 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:19:05 +01:00
										 |  |  | __cdist_object_source() | 
					
						
							| 
									
										
										
										
											2011-02-23 09:50:30 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:19:05 +01:00
										 |  |  |    cat "$1/${__cdist_name_object_source}" | 
					
						
							| 
									
										
										
										
											2011-02-23 09:50:30 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:19:05 +01:00
										 |  |  | __cdist_object_type_explorer_dir() | 
					
						
							| 
									
										
										
										
											2011-02-16 19:44:04 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:19:05 +01:00
										 |  |  |    echo "$(__cdist_object_dir "$1")/${__cdist_name_explorer}" | 
					
						
							| 
									
										
										
										
											2011-02-24 17:28:14 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2011-02-16 19:44:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | ################################################################################ | 
					
						
							|  |  |  | # Remote | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-25 00:54:49 +01:00
										 |  |  | __cdist_remote_object_dir() | 
					
						
							| 
									
										
										
										
											2011-02-24 21:24:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-02-25 00:54:49 +01:00
										 |  |  |    echo "${__cdist_remote_out_object_base_dir}/$1" | 
					
						
							| 
									
										
										
										
											2011-02-24 21:24:21 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:19:05 +01:00
										 |  |  | __cdist_remote_object_parameter_dir() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |    echo "$(__cdist_remote_object_dir "$1")/${__cdist_name_parameter}" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | __cdist_remote_object_type_explorer_dir() | 
					
						
							| 
									
										
										
										
											2011-02-25 01:06:02 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    echo "$(__cdist_remote_object_dir "$1")/${__cdist_name_explorer}" | 
					
						
							| 
									
										
										
										
											2011-02-25 01:06:02 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | __cdist_remote_type_explorer_dir() | 
					
						
							| 
									
										
										
										
											2011-03-18 01:31:30 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    echo "${__cdist_remote_type_dir}/$1/${__cdist_name_explorer}" | 
					
						
							| 
									
										
										
										
											2011-03-18 01:31:30 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | ################################################################################ | 
					
						
							|  |  |  | # Temp clenup | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | __cdist_tmp_removal() | 
					
						
							| 
									
										
										
										
											2011-02-24 21:24:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    rm -rf "${__cdist_tmp_dir}" | 
					
						
							| 
									
										
										
										
											2011-02-24 21:24:21 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | trap __cdist_tmp_removal EXIT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ################################################################################ | 
					
						
							|  |  |  | # Type | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | __cdist_type_dir() | 
					
						
							| 
									
										
										
										
											2011-02-24 17:28:14 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    echo "${__cdist_type_dir}/$1" | 
					
						
							| 
									
										
										
										
											2011-02-25 00:54:49 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | __cdist_type_explorer_dir() | 
					
						
							| 
									
										
										
										
											2011-03-16 15:49:28 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    echo "${__cdist_type_dir}/$1/${__cdist_name_explorer}" | 
					
						
							| 
									
										
										
										
											2011-03-16 15:49:28 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | __cdist_type_from_object() | 
					
						
							| 
									
										
										
										
											2011-02-25 00:54:49 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    echo "${1%%/*}" | 
					
						
							| 
									
										
										
										
											2011-02-25 00:54:49 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | __cdist_type_has_explorer() | 
					
						
							| 
									
										
										
										
											2011-02-25 00:54:49 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    # We only create output, if there's at least one explorer | 
					
						
							|  |  |  |    # and can thus be used as a boolean ;-) | 
					
						
							|  |  |  |    if [ -d "$(__cdist_type_explorer_dir "$1")" ]; then | 
					
						
							|  |  |  |       ls -1 "$(__cdist_type_explorer_dir "$1")" | 
					
						
							|  |  |  |    fi | 
					
						
							| 
									
										
										
										
											2011-02-16 19:44:04 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | __cdist_type_gencode() | 
					
						
							| 
									
										
										
										
											2011-02-16 20:12:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    echo "${__cdist_type_dir}/$1/${__cdist_name_gencode}" | 
					
						
							| 
									
										
										
										
											2011-02-16 20:12:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | __cdist_type_parameter_dir() | 
					
						
							| 
									
										
										
										
											2011-02-16 22:11:53 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    echo "$(__cdist_type_dir "$1")/${__cdist_name_parameter}" | 
					
						
							| 
									
										
										
										
											2011-02-16 22:11:53 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | __cdist_type_parameter_optional() | 
					
						
							| 
									
										
										
										
											2011-02-22 11:31:37 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    echo "$(__cdist_type_parameter_dir "$1")/$__cdist_name_parameter_optional" | 
					
						
							| 
									
										
										
										
											2011-02-22 11:31:37 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | __cdist_type_parameter_required() | 
					
						
							| 
									
										
										
										
											2011-02-05 19:32:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  |    echo "$(__cdist_type_parameter_dir "$1")/$__cdist_name_parameter_required" | 
					
						
							| 
									
										
										
										
											2011-02-05 19:32:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 11:12:39 +01:00
										 |  |  | __cdist_type_singleton() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |    echo "${__cdist_type_dir}/$1/${__cdist_name_singleton}" | 
					
						
							|  |  |  | } |