diff --git a/builder/virtualbox/step_type_boot_command.go b/builder/virtualbox/step_type_boot_command.go index 4fabeff59..f0428e551 100644 --- a/builder/virtualbox/step_type_boot_command.go +++ b/builder/virtualbox/step_type_boot_command.go @@ -59,6 +59,16 @@ func (s *stepTypeBootCommand) Run(state map[string]interface{}) multistep.StepAc continue } + if code == "wait5" { + time.Sleep(5 * time.Second) + continue + } + + if code == "wait10" { + time.Sleep(10 * time.Second) + continue + } + // Since typing is sometimes so slow, we check for an interrupt // in between each character. if _, ok := state[multistep.StateCancelled]; ok { @@ -116,11 +126,23 @@ func scancodes(message string) []string { var scancode []string if strings.HasPrefix(message, "") { - log.Printf("Special code found, will sleep at this point.") + log.Printf("Special code found, will sleep 1 second at this point.") scancode = []string{"wait"} message = message[len(""):] } + if strings.HasPrefix(message, "") { + log.Printf("Special code found, will sleep 5 seconds at this point.") + scancode = []string{"wait5"} + message = message[len(""):] + } + + if strings.HasPrefix(message, "") { + log.Printf("Special code found, will sleep 10 seconds at this point.") + scancode = []string{"wait10"} + message = message[len(""):] + } + if scancode == nil { for specialCode, specialValue := range special { if strings.HasPrefix(message, specialCode) { diff --git a/builder/vmware/step_type_boot_command.go b/builder/vmware/step_type_boot_command.go index ddd806a81..1e4bbdfd6 100644 --- a/builder/vmware/step_type_boot_command.go +++ b/builder/vmware/step_type_boot_command.go @@ -114,6 +114,20 @@ func vncSendString(c *vnc.ClientConn, original string) { continue } + if strings.HasPrefix(original, "") { + log.Printf("Special code '' found, sleeping 5 seconds") + time.Sleep(5 * time.Second) + original = original[len(""):] + continue + } + + if strings.HasPrefix(original, "") { + log.Printf("Special code '' found, sleeping 10 seconds") + time.Sleep(10 * time.Second) + original = original[len(""):] + continue + } + for specialCode, specialValue := range special { if strings.HasPrefix(original, specialCode) { log.Printf("Special code '%s' found, replacing with: %d", specialCode, specialValue)