summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Mazet <philippe.mazet@nxp.com>2019-11-21 15:10:49 +0100
committerPhilippe Mazet <philippe.mazet@nxp.com>2019-12-06 18:04:32 +0100
commit87eff59f943ed44cc9d568602ed9e2756088398c (patch)
tree8ca9fd1610c691b520525eb4a8517890cebf5db7
parent87ebea7e5ec96558bd2c9688fecd9b3b2d8e2a3d (diff)
backup.sh: allow using different tmp dir
When backup size grows, we had cases where tar was filling up /tmp This patch allows specifying a different tmp dir, used by tar (through TMPDIR variable). Example usage: TMPDIR=/home/user/mytempdir ./backup.sh
-rwxr-xr-xbackup.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/backup.sh b/backup.sh
index f4cf1de..33323b7 100755
--- a/backup.sh
+++ b/backup.sh
@@ -1,6 +1,11 @@
#!/bin/sh
BACKUP_DIR="backup-$(date +%Y%m%d_%H%M)"
+# use /tmp by default on host (this is used by tar)
+TMPDIR=${TMPDIR:-/tmp}
+export TMPDIR
+
+mkdir -p $TMPDIR
mkdir $BACKUP_DIR
cp boards.yaml $BACKUP_DIR