Copy files instead of moving is asked for. Fixes #182.

If `BS_KEEP_TEMP_FILES=1` is found on the environment, the script will copy the files instead of moving them.
This commit is contained in:
Pedro Algarvio 2013-07-16 20:31:34 +01:00
parent ac0332f997
commit 186fe4aa82

View file

@ -26,6 +26,7 @@ ScriptName="bootstrap-salt.sh"
# * BS_PIP_ALLOWED: If 1 enable pip based installations(if needed)
# * BS_ECHO_DEBUG: If 1 enable debug echo which can also be set by -D
# * BS_SALT_ETC_DIR: Defaults to /etc/salt
# * BS_KEEP_TEMP_FILES: If 1, don't move temporary files, instead copy them
# * BS_FORCE_OVERWRITE: Force overriding copied files(config, init.d, etc)
# * BS_GENTOO_USE_BINHOST: If 1 add `--getbinpkg` to gentoo's emerge
#===============================================================================
@ -217,6 +218,7 @@ __check_config_dir() {
#-----------------------------------------------------------------------
# Handle command line arguments
#-----------------------------------------------------------------------
KEEP_TEMP_FILES=${BS_KEEP_TEMP_FILES:-$BS_FALSE}
TEMP_CONFIG_DIR="null"
TEMP_KEYS_DIR="null"
INSTALL_MASTER=$BS_FALSE
@ -961,6 +963,13 @@ movefile() {
exit 1
fi
if [ $BS_KEEP_TEMP_FILES -eq $BS_TRUE ]; then
# We're being told not to move files, instead copy them so we can keep
# them around
echodebug "Since BS_KEEP_TEMP_FILES=1 we're copying files instead of moving them"
return copyfile "$sfile" "$dfile" $overwrite
fi
# Does the source file exist?
if [ ! -f "$sfile" ]; then
echowarn "$sfile does not exist!"