builder/amazon/chroot: default volumes dir is relative

This commit is contained in:
Mitchell Hashimoto 2013-07-30 22:31:07 -07:00
parent 07ed22b4fa
commit 743682d352
2 changed files with 10 additions and 1 deletions

View File

@ -72,7 +72,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
}
if b.config.MountPath == "" {
b.config.MountPath = "/var/packer-amazon-chroot/volumes/{{.Device}}"
b.config.MountPath = "packer-amazon-chroot-volumes/{{.Device}}"
}
if b.config.UnmountCommand == "" {

View File

@ -36,7 +36,16 @@ func (s *StepMountDevice) Run(state map[string]interface{}) multistep.StepAction
Device: filepath.Base(device),
})
var err error
mountPath := mountPathRaw.String()
mountPath, err = filepath.Abs(mountPath)
if err != nil {
err := fmt.Errorf("Error preparing mount directory: %s", err)
state["error"] = err
ui.Error(err.Error())
return multistep.ActionHalt
}
log.Printf("Mount path: %s", mountPath)
if err := os.MkdirAll(mountPath, 0755); err != nil {