Skip to content
This repository was archived by the owner on Feb 27, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"encoding/json"
"fmt"
"os"
"os/exec"
"runtime"
"strings"
"time"

_ "github.com/boot2docker/boot2docker-cli/dummy"
Expand All @@ -15,6 +17,28 @@ import (

// Initialize the boot2docker VM from scratch.
func cmdInit() error {

if _, err := os.Stat(B2D.SSHKey); err != nil {
if !os.IsNotExist(err) {
return fmt.Errorf("Something wrong with SSH Key file %q: %s", B2D.SSHKey, err)
}

cmd := exec.Command(B2D.SSHGen, "-t", "rsa", "-N", "", "-f", B2D.SSHKey)
if B2D.Verbose {
cmd.Stderr = os.Stderr
fmt.Printf("executing: %v %v", cmd.Path, strings.Join(cmd.Args, " "))
}
b, err := cmd.Output()
if err != nil {
return fmt.Errorf("Error generating new SSH Key into %s: %s", B2D.SSHKey, err)
}
out := string(b)
if B2D.Verbose {
fmt.Printf("%s returned: %s\nEND\n", B2D.SSHKey, out)
}
}
//TODO: print a ~/.ssh/config entry for our b2d connection that the user can c&p

B2D.Init = true
_, err := driver.GetMachine(&B2D)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion util.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func getSSHCommand(m driver.Machine, args ...string) *exec.Cmd {
cmd := exec.Command(B2D.SSH, sshArgs...)
if B2D.Verbose {
cmd.Stderr = os.Stderr
log.Printf("executing: %v %v", B2D.SSH, strings.Join(sshArgs, " "))
log.Printf("executing: %v %v", cmd.Path, strings.Join(cmd.Args, " "))
}

return cmd
Expand Down