nix-prefetch-git: provide fallback for $TMPDIR

$TMPDIR is not set by default in NixOS (nor Ubuntu), so without this
change nix-prefetch-git fails when using git-lfs.
This commit is contained in:
Bjørn Forsman 2021-08-15 08:35:47 +02:00
parent b769bd2b01
commit f43829a1d8

View File

@ -300,7 +300,9 @@ clone_user_rev() {
local rev="${3:-HEAD}"
if [ -n "$fetchLFS" ]; then
HOME=$TMPDIR
tmpHomePath="$(mktemp -d -p nix-prefetch-git-tmp-home-XXXXXXXXXX)"
exit_handlers+=(remove_tmpHomePath)
HOME="$tmpHomePath"
git lfs install
fi
@ -408,6 +410,10 @@ remove_tmpPath() {
rm -rf "$tmpPath"
}
remove_tmpHomePath() {
rm -rf "$tmpHomePath"
}
if test -n "$QUIET"; then
quiet_mode
fi