diff --git a/backup_new.sh b/backup_new.sh index fff1e0d..07a7f1d 100755 --- a/backup_new.sh +++ b/backup_new.sh @@ -495,6 +495,27 @@ exclusions=1 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" + + + +