3ca9b2
From b65de0f71c33ae1d3558132261f159e321c8edf1 Mon Sep 17 00:00:00 2001
3ca9b2
From: Matthew Heon <mheon@redhat.com>
3ca9b2
Date: Mon, 17 Aug 2020 09:24:41 -0400
3ca9b2
Subject: [PATCH] Add support for setting the large files tmpdir to v1.6
3ca9b2
3ca9b2
This is based on 2c328f94b61116bfa7d1d46525d854678f94c9f3 by Les
3ca9b2
Aker, and e53fc16b9f470a137abf182b0561a16447bfd5b7 by Dan Walsh
3ca9b2
(the latter from containers/buildah). They have been merge here
3ca9b2
to allow this to compile on the older v1.6 branch of Podman.
3ca9b2
3ca9b2
Unfortunately this does not fix Buildah, as the Buildah patches
3ca9b2
are too new to apply on top of this old branch.
3ca9b2
3ca9b2
Signed-off-by: Matthew Heon <mheon@redhat.com>
3ca9b2
---
3ca9b2
 libpod/image/docker_registry_options.go | 11 ++++++++++-
3ca9b2
 1 file changed, 10 insertions(+), 1 deletion(-)
3ca9b2
3ca9b2
diff --git a/libpod/image/docker_registry_options.go b/libpod/image/docker_registry_options.go
3ca9b2
index 62a4af4653..b1eb31e2db 100644
3ca9b2
--- a/libpod/image/docker_registry_options.go
3ca9b2
+++ b/libpod/image/docker_registry_options.go
3ca9b2
@@ -2,10 +2,10 @@ package image
3ca9b2
 
3ca9b2
 import (
3ca9b2
 	"fmt"
3ca9b2
+	"os"
3ca9b2
 
3ca9b2
 	"github.com/containers/image/v5/docker/reference"
3ca9b2
 	"github.com/containers/image/v5/types"
3ca9b2
-
3ca9b2
 	podmanVersion "github.com/containers/libpod/version"
3ca9b2
 )
3ca9b2
 
3ca9b2
@@ -41,6 +41,7 @@ func (o DockerRegistryOptions) GetSystemContext(parent *types.SystemContext, add
3ca9b2
 		DockerArchiveAdditionalTags: additionalDockerArchiveTags,
3ca9b2
 		OSChoice:                    o.OSChoice,
3ca9b2
 		ArchitectureChoice:          o.ArchitectureChoice,
3ca9b2
+		BigFilesTemporaryDir:        GetTempDir(),
3ca9b2
 	}
3ca9b2
 	if parent != nil {
3ca9b2
 		sc.SignaturePolicyPath = parent.SignaturePolicyPath
3ca9b2
@@ -65,3 +66,11 @@ func GetSystemContext(signaturePolicyPath, authFilePath string, forceCompress bo
3ca9b2
 
3ca9b2
 	return sc
3ca9b2
 }
3ca9b2
+
3ca9b2
+// Retrieve the temporary directory for storing large files.
3ca9b2
+func GetTempDir() string {
3ca9b2
+	if tmpdir, ok := os.LookupEnv("TMPDIR"); ok {
3ca9b2
+		return tmpdir
3ca9b2
+	}
3ca9b2
+	return "/var/tmp"
3ca9b2
+}