From 961b664c47331cb5a2c025710bb15b9cae162d44 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Sat, 10 Sep 2022 21:01:06 +0200 Subject: [PATCH 1/6] we use a directory in /tmp as workplace --- bin/freight-cache | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/freight-cache b/bin/freight-cache index f1d78a6..c2bae24 100755 --- a/bin/freight-cache +++ b/bin/freight-cache @@ -78,9 +78,11 @@ LIB="$(cd "$(dirname "$(dirname "$0")")/lib/freight" && pwd)" # If `GPG_DIGEST_ALGO` is unset, force it to the freight default of SHA512 [ -z "$GPG_DIGEST_ALGO" ] && GPG_DIGEST_ALGO="SHA512" -# Create a working directory on the same device as the Freight cache. +# make sure the cache-directory exists mkdir -p "$VARCACHE" -TMP="$(mktemp -d "$VARCACHE/work.$$.XXXXXXXXXX")" + +# Create a temporary working directory for extracting files +TMP="$(mktemp -d "/tmp/work.$$.XXXXXXXXXX")" # shellcheck disable=SC2064 trap "rm -rf \"$TMP\"" EXIT INT TERM From 599d75cd6aebb3fc413fecb68cdd11cda38ab7fd Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Sat, 10 Sep 2022 21:39:07 +0200 Subject: [PATCH 2/6] the temporary directory is now configurable --- bin/freight-cache | 2 +- bin/freight-init | 7 ++++++- etc/freight.conf.example | 6 ++++++ lib/freight/conf.sh | 1 + man/man1/freight-init.1.ronn | 4 +++- man/man5/freight.5.ronn | 2 ++ 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/bin/freight-cache b/bin/freight-cache index c2bae24..e112aef 100755 --- a/bin/freight-cache +++ b/bin/freight-cache @@ -82,7 +82,7 @@ LIB="$(cd "$(dirname "$(dirname "$0")")/lib/freight" && pwd)" mkdir -p "$VARCACHE" # Create a temporary working directory for extracting files -TMP="$(mktemp -d "/tmp/work.$$.XXXXXXXXXX")" +TMP="$(mktemp -d "$TEMPDIR/work.$$.XXXXXXXXXX")" # shellcheck disable=SC2064 trap "rm -rf \"$TMP\"" EXIT INT TERM diff --git a/bin/freight-init b/bin/freight-init index 867d74e..a2187c6 100755 --- a/bin/freight-init +++ b/bin/freight-init @@ -2,11 +2,12 @@ # Initialize a Freight directory (similar to git init). -#/ Usage: freight init -g [--libdir=] [--cachedir=] [--archs=] [--origin=] [--label=