Skip to content
This repository has been archived by the owner on Feb 27, 2018. It is now read-only.

Commit

Permalink
Add configuration flag allowing the use of a custom b2d ISO
Browse files Browse the repository at this point in the history
  • Loading branch information
github-brice-jaglin committed Oct 6, 2014
1 parent d35fa59 commit 778d4a2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ VM = "boot2docker-vm"
# path to boot2docker ISO image
ISO = "/Users/sven/.boot2docker/boot2docker.iso"

# when non-empty, URL to fetch the custom boot2docker ISO image from
URLCustomISO = "http://internal.corp.org/b2d.iso"

# VM disk image size in MB
DiskSize = 20000

Expand Down
22 changes: 14 additions & 8 deletions cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,21 @@ func cmdIP() error {

// Download the boot2docker ISO image.
func cmdDownload() error {
fmt.Println("Downloading boot2docker ISO image...")
url := "https://api.github.com/repos/boot2docker/boot2docker/releases"
tag, err := getLatestReleaseName(url)
if err != nil {
return fmt.Errorf("Failed to get latest release: %s", err)
}
fmt.Printf("Latest release is %s\n", tag)
url := ""
if B2D.URLCustomISO == "" {
url = "https://api.github.com/repos/boot2docker/boot2docker/releases"
tag, err := getLatestReleaseName(url)
if err != nil {
return fmt.Errorf("Failed to get latest release: %s", err)
}
fmt.Printf("Latest release is %s\n", tag)

url = fmt.Sprintf("https://github.com/boot2docker/boot2docker/releases/download/%s/boot2docker.iso", tag)
fmt.Println("Downloading latest official boot2docker ISO image...")
url = fmt.Sprintf("https://github.com/boot2docker/boot2docker/releases/download/%s/boot2docker.iso", tag)
} else {
fmt.Println("Downloading custom boot2docker ISO image...")
url = B2D.URLCustomISO
}
if err := download(B2D.ISO, url); err != nil {
return fmt.Errorf("Failed to download ISO image: %s", err)
}
Expand Down
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func config() (*flag.FlagSet, error) {
//flags.StringVarP(&B2D.Dir, "dir", "d", dir, "boot2docker config directory.")
B2D.Dir = dir
flags.StringVar(&B2D.ISO, "iso", filepath.Join(dir, "boot2docker.iso"), "path to boot2docker ISO image.")
flags.StringVar(&B2D.URLCustomISO, "urlcustomiso", "", "URL of a custom boot2docker ISO to download instead of the official one.")

// Sven disabled this, as it is broken - if I user with a fresh computer downloads
// just the boot2docker-cli, and then runs `boot2docker --init ip`, we create a vm
Expand Down
17 changes: 9 additions & 8 deletions driver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ type MachineConfig struct {
Driver string

// basic config
SSH string // SSH client executable
SSHGen string // SSH keygen executable
SSHKey string // SSH key to send to the vm
VM string // virtual machine name
Dir string // boot2docker directory
ISO string // boot2docker ISO image path
DiskSize uint // VM disk image size (MB)
Memory uint // VM memory size (MB)
SSH string // SSH client executable
SSHGen string // SSH keygen executable
SSHKey string // SSH key to send to the vm
VM string // virtual machine name
Dir string // boot2docker directory
ISO string // boot2docker ISO image path
URLCustomISO string // custom ISO image URL
DiskSize uint // VM disk image size (MB)
Memory uint // VM memory size (MB)

// NAT network: port forwarding
SSHPort uint16 // host SSH port (forward to port 22 in VM)
Expand Down

0 comments on commit 778d4a2

Please sign in to comment.