Correct error checking within tmp dir creation section

This commit is contained in:
Asif Bacchus 2018-10-16 02:02:04 -06:00
parent fc3c793dc2
commit e7f5a836ec

View File

@ -642,15 +642,18 @@ fi
## the 'noexec' option for security. Thus, we will use/create a 'tmp' folder ## the 'noexec' option for security. Thus, we will use/create a 'tmp' folder
## within the BORG_BASE_DIR and instruct python to use that instead of /tmp ## within the BORG_BASE_DIR and instruct python to use that instead of /tmp
# check if BORG_BASE_DIR/tmp exists, if not, create it # check if BORG_BASE_DIR/tmp exists, if not, create it
echo -e "${op}${stamp} Checking for tmp directory for borg..." \ echo -e "${op}${stamp} Checking for tmp directory at ${lit}${BORG_BASE_DIR}" \
"${normal}" >> "$logFile" "${normal}" >> "$logFile"
checkExist fd "$BORG_BASE_DIR/tmp" checkExist fd "$BORG_BASE_DIR/tmp"
checkResult="$?" checkResult="$?"
if [ "$checkResult" = "1" ]; then if [ "$checkResult" = "1" ]; then
# folder not found # folder not found
echo -e "${op}${stamp} tmp folder not found... creating ${lit}" \
"${BORG_BASE_DIR}/tmp${normal}" >> "$logFile"
mkdir "$BORG_BASE_DIR/tmp" 2>> "$logFile" mkdir "$BORG_BASE_DIR/tmp" 2>> "$logFile"
# verify folder created # verify folder created
checkExist fd "$BORG_BASE_DIR/tmp" checkExist fd "$BORG_BASE_DIR/tmp"
checkResult="$?"
if [ "$checkResult" = "0" ]; then if [ "$checkResult" = "0" ]; then
# folder exists # folder exists
echo -e "${op}${stamp} tmp folder created within borg base directory" \ echo -e "${op}${stamp} tmp folder created within borg base directory" \