packer-cn/builder/vmware/common/driver_player6.go

57 lines
988 B
Go
Raw Normal View History

package common
import (
"os/exec"
)
const VMWARE_PLAYER_VERSION = "6"
// Player6Driver is a driver that can run VMware Player 6
// installations.
type Player6Driver struct {
Player5Driver
}
2020-09-17 04:38:33 -04:00
func NewPlayer6Driver(config *SSHConfig) Driver {
return &Player6Driver{
Player5Driver: Player5Driver{
SSHConfig: config,
},
}
}
func (d *Player6Driver) Clone(dst, src string, linked bool) error {
// TODO(rasa) check if running player+, not just player
2018-06-30 11:31:42 -04:00
var cloneType string
if linked {
cloneType = "linked"
} else {
cloneType = "full"
}
cmd := exec.Command(d.Player5Driver.VmrunPath,
"-T", "ws",
"clone", src, dst,
2018-06-30 11:31:42 -04:00
cloneType)
if _, _, err := runAndLog(cmd); err != nil {
return err
}
return nil
}
func (d *Player6Driver) Verify() error {
if err := d.Player5Driver.Verify(); err != nil {
return err
}
return playerVerifyVersion(VMWARE_PLAYER_VERSION)
}
func (d *Player6Driver) GetVmwareDriver() VmwareDriver {
return d.Player5Driver.VmwareDriver
}