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