commit 226e3612bad3279b23c6cb02bb3d4cd2f38f61e5
parent 36504de09b8f3b4ba8787b1833a9687070fcda74
Author: Vincent Demeester <vincent@sbr.pm>
Date: Fri, 5 Jun 2020 17:42:39 +0200
hack/system: allow specify the workdir 🚡
This is especially useful for a low-memory system that has `/tmp`
mounted as tmpfs.
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/hack/system b/hack/system
@@ -1,6 +1,7 @@
#! /usr/bin/env bash
set -o pipefail -o noclobber -o nounset
+WORKDIR=${WORKDIR-}
function error() {
local red
local reset
@@ -12,10 +13,12 @@ function error() {
}
function set_work_dir() {
- if [[ ! -v WORK_DIR ]]; then
+ if [[ -z "${WORKDIR}" && ! -v WORK_DIR ]]; then
WORK_DIR="$(mktemp --tmpdir -u nix-config-sync.XXXXXXXXXX)"
# shellcheck disable=2064
trap "rm -rf '$WORK_DIR'" EXIT
+ else
+ WORK_DIR="${WORKDIR}"
fi
}