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:
Nico Schottelius 2011-09-05 10:01:56 +02:00
parent a5564850ce
commit 2b955b09bc
3 changed files with 58 additions and 19 deletions

View file

@ -165,11 +165,6 @@ for __cdist_lib in $__cdist_core_dir/*; do
. "$__cdist_lib"
done
___cdist_lib_path()
{
echo $_
}
################################################################################
# Cache
@ -213,7 +208,6 @@ __cdist_object_base_dir()
echo "${__cdist_out_object_dir}/$1"
}
__cdist_object_id_from_object()
{
echo "${1#*/}"
@ -290,19 +284,6 @@ __cdist_remote_type_explorer_dir()
################################################################################
# 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
trap __cdist_tmp_removal EXIT

View 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
View 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}"
}