diff --git a/README.md b/README.md index dc15748..af32efa 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/cmds.go b/cmds.go index f82c979..8a5cc96 100644 --- a/cmds.go +++ b/cmds.go @@ -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) } diff --git a/config.go b/config.go index 99db276..80fbd73 100644 --- a/config.go +++ b/config.go @@ -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 diff --git a/driver/config.go b/driver/config.go index 5d11167..20f33d7 100644 --- a/driver/config.go +++ b/driver/config.go @@ -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)