create borg tmp dir

This commit is contained in:
Asif Bacchus 2019-05-27 03:53:43 -06:00
parent 2b66d9e118
commit 87bfeb8464

View File

@ -495,6 +495,27 @@ exclusions=1
fi fi
### create borg temp dir:
## python requires a writable temporary directory when unpacking borg and
## executing commands. This defaults to /tmp but many systems mount /tmp with
## 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
# check if BORG_BASE_DIR/tmp exists, if not, create it
if [ ! -d "${borgBaseDir}/tmp" ]; then
if ! mkdir "${borgBaseDir}/tmp"; then
exitError 132 "Unable to create borg ${borgBaseDir}/tmp directory"
else
printf "${cyan}[%s] -- [INFO] Created ${yellow}%s/tmp " \
"$(stamp)" "${borgBaseDir}" >> "$logFile"
printf "${cyan}--${norm}\n" >> "$logFile"
fi
fi
export TMPDIR="${borgBaseDir}/tmp"