From 186fe4aa827b41eae8b54c0c8e6ea462e7bcd8a7 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 16 Jul 2013 20:31:34 +0100 Subject: [PATCH] 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. --- bootstrap-salt.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index d0008e4..d91a0ae 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -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!"