Upload the linux.iso to /tmp/linux.iso.
This commit is contained in:
parent
d4aea92f57
commit
da3b0f54c7
|
@ -222,6 +222,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
&stepRun{},
|
&stepRun{},
|
||||||
&stepTypeBootCommand{},
|
&stepTypeBootCommand{},
|
||||||
&stepWaitForSSH{},
|
&stepWaitForSSH{},
|
||||||
|
&stepUploadTools{},
|
||||||
&stepProvision{},
|
&stepProvision{},
|
||||||
&stepShutdown{},
|
&stepShutdown{},
|
||||||
&stepCleanFiles{},
|
&stepCleanFiles{},
|
||||||
|
|
|
@ -121,6 +121,11 @@ func (d *Fusion5Driver) vmrunPath() string {
|
||||||
return filepath.Join(d.AppPath, "Contents", "Library", "vmrun")
|
return filepath.Join(d.AppPath, "Contents", "Library", "vmrun")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @TODO: Be smarter about guest type before deciding on linux.iso.
|
||||||
|
func (d *Fusion5Driver) vmwareToolsIsoPath() string {
|
||||||
|
return filepath.Join(d.AppPath, "Contents", "Library", "isoimages", "linux.iso")
|
||||||
|
}
|
||||||
|
|
||||||
func (d *Fusion5Driver) runAndLog(cmd *exec.Cmd) (string, string, error) {
|
func (d *Fusion5Driver) runAndLog(cmd *exec.Cmd) (string, string, error) {
|
||||||
var stdout, stderr bytes.Buffer
|
var stdout, stderr bytes.Buffer
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package vmware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/mitchellh/multistep"
|
||||||
|
"github.com/mitchellh/packer/packer"
|
||||||
|
"log"
|
||||||
|
)
|
||||||
|
|
||||||
|
a {
|
||||||
|
|
||||||
|
type stepUploadTools struct{}
|
||||||
|
|
||||||
|
func (*stepUploadTools) Run(state map[string]interface{}) multistep.StepAction {
|
||||||
|
comm := state["communicator"].(packer.Communicator)
|
||||||
|
ui := state["ui"].(packer.Ui)
|
||||||
|
driver := state["driver"].(Driver)
|
||||||
|
|
||||||
|
ui.Say("Uploading the VMware Tools.")
|
||||||
|
log.Println("Uploading the VMware Tools.")
|
||||||
|
|
||||||
|
f, err := os.Open(driver.vmwareToolsIsoPath())
|
||||||
|
if err != nil {
|
||||||
|
state["error"] = fmt.Errorf("Error opening VMware Tools ISO: %s", err)
|
||||||
|
return multistep.ActionHalt
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := comm.Upload("/tmp/linux.iso", f); err != nil {
|
||||||
|
state["error"] = fmt.Errorf("Error uploading VMware Tools: %s", err)
|
||||||
|
return multistep.ActionHalt
|
||||||
|
}
|
||||||
|
|
||||||
|
return multistep.ActionContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*stepUploadTools) Cleanup(map[string]interface{}) {}
|
Loading…
Reference in New Issue