Default cache to "packer_cache" in CWD
This commit is contained in:
parent
cea6f90f39
commit
8b72879453
20
packer.go
20
packer.go
|
@ -36,17 +36,19 @@ func main() {
|
||||||
|
|
||||||
defer plugin.CleanupClients()
|
defer plugin.CleanupClients()
|
||||||
|
|
||||||
var cache packer.Cache
|
cacheDir := os.Getenv("PACKER_CACHE_DIR")
|
||||||
if cacheDir := os.Getenv("PACKER_CACHE_DIR"); cacheDir != "" {
|
if cacheDir == "" {
|
||||||
if err := os.MkdirAll(cacheDir, 0755); err != nil {
|
cacheDir = "packer_cache"
|
||||||
fmt.Fprintf(os.Stderr, "Error preparing cache directory: \n\n%s\n", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Printf("Setting cache directory: %s", cacheDir)
|
|
||||||
cache = &packer.FileCache{CacheDir: cacheDir}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := os.MkdirAll(cacheDir, 0755); err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error preparing cache directory: \n\n%s\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Printf("Setting cache directory: %s", cacheDir)
|
||||||
|
cache := &packer.FileCache{CacheDir: cacheDir}
|
||||||
|
|
||||||
envConfig := packer.DefaultEnvironmentConfig()
|
envConfig := packer.DefaultEnvironmentConfig()
|
||||||
envConfig.Cache = cache
|
envConfig.Cache = cache
|
||||||
envConfig.Commands = config.CommandNames()
|
envConfig.Commands = config.CommandNames()
|
||||||
|
|
Loading…
Reference in New Issue