move out all functions that do not only print a value from bin/cdist-config
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								a5564850ce
							
						
					
				
			
			
				commit
				
					
						2b955b09bc
					
				
			
		
					 3 changed files with 58 additions and 19 deletions
				
			
		| 
						 | 
					@ -165,11 +165,6 @@ for __cdist_lib in $__cdist_core_dir/*; do
 | 
				
			||||||
   . "$__cdist_lib"
 | 
					   . "$__cdist_lib"
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
___cdist_lib_path()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
   echo $_
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
# Cache
 | 
					# Cache
 | 
				
			||||||
| 
						 | 
					@ -213,7 +208,6 @@ __cdist_object_base_dir()
 | 
				
			||||||
   echo "${__cdist_out_object_dir}/$1"
 | 
					   echo "${__cdist_out_object_dir}/$1"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
__cdist_object_id_from_object()
 | 
					__cdist_object_id_from_object()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
   echo "${1#*/}"
 | 
					   echo "${1#*/}"
 | 
				
			||||||
| 
						 | 
					@ -290,19 +284,6 @@ __cdist_remote_type_explorer_dir()
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
# Traps
 | 
					# Traps
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
__cdist_tmp_removal()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
   rm -rf "${__cdist_tmp_dir}"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Does not work in children, will be called again in every script!
 | 
					 | 
				
			||||||
# Use only in interactive "front end" scripts
 | 
					 | 
				
			||||||
__cdist_kill_on_interrupt()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
   __cdist_tmp_removal
 | 
					 | 
				
			||||||
   kill 0
 | 
					 | 
				
			||||||
   exit 1
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Remove tempfiles at normal exit
 | 
					# Remove tempfiles at normal exit
 | 
				
			||||||
trap __cdist_tmp_removal EXIT
 | 
					trap __cdist_tmp_removal EXIT
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										31
									
								
								core/__cdist_kill_on_interrupt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								core/__cdist_kill_on_interrupt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,31 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# 2011 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/>.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# 
 | 
				
			||||||
 | 
					# Run the given command for each created object.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Does not work in children, will be called again in every script!
 | 
				
			||||||
 | 
					# Use only in interactive "front end" scripts
 | 
				
			||||||
 | 
					__cdist_kill_on_interrupt()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					   __cdist_tmp_removal
 | 
				
			||||||
 | 
					   kill 0
 | 
				
			||||||
 | 
					   exit 1
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										27
									
								
								core/__cdist_tmp_removal
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										27
									
								
								core/__cdist_tmp_removal
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,27 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# 2011 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/>.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Remove tmp dir
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__cdist_tmp_removal()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					   rm -rf "${__cdist_tmp_dir}"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue