spiegel_podman/vendor/github.com/containers/buildah/internal/tmpdir/tmpdir.go
Paul Holzinger 2c2299ad85
bump buildah to latest
Also includes a small change to make us of
https://github.com/containers/buildah/pull/5039

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-09-14 11:20:48 +02:00

28 lines
583 B
Go

package tmpdir
import (
"os"
"path/filepath"
"github.com/containers/common/pkg/config"
"github.com/sirupsen/logrus"
)
// GetTempDir returns base for a temporary directory on host.
func GetTempDir() string {
if tmpdir, ok := os.LookupEnv("TMPDIR"); ok {
abs, err := filepath.Abs(tmpdir)
if err == nil {
return abs
}
logrus.Warnf("ignoring TMPDIR from environment, evaluating it: %v", err)
}
containerConfig, err := config.Default()
if err != nil {
tmpdir, err := containerConfig.ImageCopyTmpDir()
if err != nil {
return tmpdir
}
}
return "/var/tmp"
}