Honor RESTIC_CACHE_DIR environment variable

Fix #3382: restic check doesn't obey the RESTIC_CACHE_DIR environment variable
This commit is contained in:
kitone committed 2021-10-10 16:00:02 +02:00
1 parent 553ea36ca6
commit 95eb859b54
2 files changed
+10 -1

No files matched your search

+4
View File
@@ -9,6 +9,7 @@ import (
"github.com/spf13/cobra"
"github.com/restic/restic/internal/cache"
"github.com/restic/restic/internal/checker"
"github.com/restic/restic/internal/errors"
"github.com/restic/restic/internal/fs"
@@ -146,6 +147,9 @@ func prepareCheckCache(opts CheckOptions, gopts *GlobalOptions) (cleanup func())
}
cachedir := gopts.CacheDir
if cachedir == "" {
cachedir = cache.EnvDir()
}
// use a cache in a temporary directory
tempdir, err := ioutil.TempDir(cachedir, "restic-check-cache-")