Commit c98c16a5 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

Support PACKER_CACHE_DIR

parent 5307e539
......@@ -38,7 +38,19 @@ func main() {
defer plugin.CleanupClients()
var cache packer.Cache
if cacheDir := os.Getenv("PACKER_CACHE_DIR"); 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.Cache = cache
envConfig.Commands = config.CommandNames()
envConfig.Components.Builder = config.LoadBuilder
envConfig.Components.Command = config.LoadCommand
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment