Be smarter about loading guest additions iso. Windows 10 and Windows Server 2016 no longer come with iso. So default to not loading guest additions when the iso is missing
This commit is contained in:
parent
143ac300bf
commit
74255c553b
|
@ -182,11 +182,30 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
||||||
|
|
||||||
// Errors
|
// Errors
|
||||||
if b.config.GuestAdditionsMode == "" {
|
if b.config.GuestAdditionsMode == "" {
|
||||||
b.config.GuestAdditionsMode = "attach"
|
if b.config.GuestAdditionsPath != "" {
|
||||||
|
b.config.GuestAdditionsMode = "attach"
|
||||||
|
} else {
|
||||||
|
b.config.GuestAdditionsPath = os.Getenv("WINDIR") + "\\system32\\vmguest.iso"
|
||||||
|
|
||||||
|
if _, err := os.Stat(b.config.GuestAdditionsPath); os.IsNotExist(err) {
|
||||||
|
if err != nil {
|
||||||
|
b.config.GuestAdditionsPath = ""
|
||||||
|
b.config.GuestAdditionsMode = "none"
|
||||||
|
} else {
|
||||||
|
b.config.GuestAdditionsMode = "attach"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.config.GuestAdditionsPath == "" {
|
if b.config.GuestAdditionsPath == "" && b.config.GuestAdditionsMode == "attach" {
|
||||||
b.config.GuestAdditionsPath = os.Getenv("WINDIR") + "\\system32\\vmguest.iso"
|
b.config.GuestAdditionsPath = os.Getenv("WINDIR") + "\\system32\\vmguest.iso"
|
||||||
|
|
||||||
|
if _, err := os.Stat(b.config.GuestAdditionsPath); os.IsNotExist(err) {
|
||||||
|
if err != nil {
|
||||||
|
b.config.GuestAdditionsPath = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, isoPath := range b.config.SecondaryDvdImages {
|
for _, isoPath := range b.config.SecondaryDvdImages {
|
||||||
|
|
Loading…
Reference in New Issue