From cf2e5d054bfeb075125749b79f9fbcf585763859 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 21 Oct 2015 14:40:53 -0700 Subject: [PATCH] Bump virtualbox, include machine binaries Signed-off-by: Jeffrey Morgan --- Dockerfile.osx | 4 +- Dockerfile.windows | 25 +++++++----- windows/Toolbox.iss | 99 +++++++++++++++++++++------------------------ 3 files changed, 65 insertions(+), 63 deletions(-) diff --git a/Dockerfile.osx b/Dockerfile.osx index ae3e052789..4c4951a575 100644 --- a/Dockerfile.osx +++ b/Dockerfile.osx @@ -18,8 +18,8 @@ RUN curl -fsSL https://github.com/mackyle/xar/archive/xar-1.6.1.tar.gz | tar xvz ./autogen.sh && ./configure && \ make && make install -ENV VBOX_VERSION 5.0.6 -ENV VBOX_REV 103037 +ENV VBOX_VERSION 5.0.8 +ENV VBOX_REV 103449 RUN curl -fsSL -o /vbox.dmg http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VirtualBox-$VBOX_VERSION-$VBOX_REV-OSX.dmg \ && echo "$(curl -fsSL 'http://download.virtualbox.org/virtualbox/'"$VBOX_VERSION"'/SHA256SUMS' | awk '$2 ~ /-OSX.dmg$/ { print $1 }') */vbox.dmg" | sha256sum -c - diff --git a/Dockerfile.windows b/Dockerfile.windows index 7ce84ab7da..f5d503a42d 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -17,21 +17,28 @@ RUN cd innosetup && \ wine "./innounp.exe" -e "is-unicode.exe" # installer components -ENV INSTALLER_VERSION 1.8.3 -ENV DOCKER_VERSION 1.8.3 -ENV DOCKER_MACHINE_VERSION 0.4.1 +ENV INSTALLER_VERSION 1.9.0-rc1 +ENV DOCKER_VERSION 1.9.0-rc1 +ENV DOCKER_MACHINE_VERSION 0.5.0-rc2 ENV BOOT2DOCKER_ISO_VERSION $DOCKER_VERSION -ENV KITEMATIC_VERSION 0.8.7 -ENV VIRTUALBOX_VERSION 5.0.6 -ENV VIRTUALBOX_REVISION 103037 +ENV KITEMATIC_VERSION 0.9.0 +ENV VIRTUALBOX_VERSION 5.0.8 +ENV VIRTUALBOX_REVISION 103449 ENV GIT_VERSION 2.5.0 ENV MIXPANEL_TOKEN c306ae65c33d7d09fe3e546f36493a6e RUN mkdir /bundle WORKDIR /bundle -RUN curl -fsSL -o docker.exe "https://get.docker.com/builds/Windows/x86_64/docker-$DOCKER_VERSION.exe" -RUN curl -fsSL -o docker-machine.exe "https://github.com/docker/machine/releases/download/v$DOCKER_MACHINE_VERSION/docker-machine_windows-amd64.exe" -RUN curl -fsSL -o boot2docker.iso https://github.com/boot2docker/boot2docker/releases/download/v$BOOT2DOCKER_ISO_VERSION/boot2docker.iso +# RUN curl -fsSL -o docker.exe "https://get.docker.com/builds/Windows/x86_64/docker-$DOCKER_VERSION.exe" +RUN curl -fsSL -o docker.exe "https://test.docker.com/builds/Windows/x86_64/docker-$DOCKER_VERSION.exe" + +RUN curl -fsSL -o docker-machine.zip "https://github.com/docker/machine/releases/download/v$DOCKER_MACHINE_VERSION/docker-machine_windows-amd64.zip" && \ + unzip docker-machine.zip && \ + rm docker-machine.zip + +# RUN curl -fsSL -o boot2docker.iso https://github.com/boot2docker/boot2docker/releases/download/v$BOOT2DOCKER_ISO_VERSION/boot2docker.iso +RUN curl -fsSL -o boot2docker.iso https://github.com/tianon/boot2docker-legacy/releases/download/v$BOOT2DOCKER_ISO_VERSION/boot2docker.iso + RUN curl -fsSL -o kitematic.zip "https://github.com/kitematic/kitematic/releases/download/v$KITEMATIC_VERSION/Kitematic-$KITEMATIC_VERSION-Windows-Alpha.zip" && \ mkdir kitematic && \ cd kitematic && \ diff --git a/windows/Toolbox.iss b/windows/Toolbox.iss index ffcc1a9a3f..f247b8cb85 100644 --- a/windows/Toolbox.iss +++ b/windows/Toolbox.iss @@ -5,7 +5,7 @@ #define b2dIsoPath "..\bundle\boot2docker.iso" #define dockerCli "..\bundle\docker.exe" -#define dockerMachineCli "..\bundle\docker-machine.exe" +#define dockerMachineCli "..\bundle\docker-machine*.exe" #define kitematic "..\bundle\kitematic" #define git "..\bundle\Git.exe" #define virtualBoxCommon "..\bundle\common.cab" @@ -28,7 +28,8 @@ DefaultDirName={pf}\{#MyAppName} DefaultGroupName=Docker DisableProgramGroupPage=yes OutputBaseFilename=DockerToolbox -Compression=lzma +// Compression=lzma +Compression=none SolidCompression=yes WizardImageFile=windows-installer-side.bmp WizardSmallImageFile=windows-installer-logo.bmp @@ -51,6 +52,7 @@ Filename: "{win}\explorer.exe"; Parameters: "{userprograms}\Docker\"; Flags: pos [Tasks] Name: desktopicon; Description: "{cm:CreateDesktopIcon}" Name: modifypath; Description: "Add docker.exe & docker-machine.exe to &PATH" +Name: upgradevm; Description: "Upgrade or Migrate Boot2Docker VM to latest version of Docker if it exists." [Components] Name: "Docker"; Description: "Docker Client for Windows" ; Types: full custom; Flags: fixed @@ -166,6 +168,14 @@ begin ); end; +function VBoxPath(): String; +begin + if GetEnv('VBOX_INSTALL_PATH') <> '' then + Result := GetEnv('VBOX_INSTALL_PATH') + else + Result := GetEnv('VBOX_MSI_INSTALL_PATH') +end; + function NeedToInstallGit(): Boolean; begin // TODO: Find a better way to see if Git is installed @@ -233,7 +243,7 @@ begin TrackingLabel.Height := 100; // Don't do this until we can compare versions - // Wizardform.ComponentsList.Checked[2] := NeedToInstallVirtualBox(); + Wizardform.ComponentsList.Checked[2] := NeedToInstallVirtualBox(); Wizardform.ComponentsList.ItemEnabled[2] := not NeedToInstallVirtualBox(); Wizardform.ComponentsList.Checked[4] := NeedToInstallGit(); Wizardform.ComponentsList.ItemEnabled[4] := not NeedToInstallGit(); @@ -287,50 +297,26 @@ begin MsgBox('File moving failed!', mbError, MB_OK); end; -function CanMigrateVM(): Boolean; -var - ResultCode: Integer; -begin - if NeedToInstallGit() or NeedToInstallVirtualBox() or not FileExists(ExpandConstant('{app}\docker-machine.exe')) then begin - Result := false - exit - end; - - ExecAsOriginalUser('C:\Program Files\Oracle\VirtualBox\VBoxManage.exe', 'showvminfo default', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) - if ResultCode <> 1 then begin - Result := false - exit - end; - - ExecAsOriginalUser('C:\Program Files\Oracle\VirtualBox\VBoxManage.exe', 'showvminfo boot2docker-vm', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) - if ResultCode <> 0 then begin - Result := false - exit - end; - Result := true -end; - function CanUpgradeVM(): Boolean; var ResultCode: Integer; begin - if NeedToInstallGit() or NeedToInstallVirtualBox() or not FileExists(ExpandConstant('{app}\docker-machine.exe')) then begin + if NeedToInstallVirtualBox() or not FileExists(ExpandConstant('{app}\docker-machine.exe')) then begin Result := false exit end; - ExecAsOriginalUser('C:\Program Files\Oracle\VirtualBox\VBoxManage.exe', 'showvminfo default', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) + ExecAsOriginalUser(VBoxPath() + 'VBoxManage.exe', 'showvminfo default', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) if ResultCode <> 0 then begin Result := false exit end; - if not DirExists(ExpandConstant('{userdocs}\..\.docker\machine\default')) then begin + if not DirExists(ExpandConstant('{userdocs}\..\.docker\machine\machines\default')) then begin Result := false exit end; - // TODO: Check versions in machine Result := true end; @@ -339,16 +325,16 @@ var ResultCode: Integer; begin TrackEvent('VM Upgrade Started'); - ExecAsOriginalUser(ExpandConstant('{app}\docker-machine.exe'), ExpandConstant('upgrade default > {localappdata}\Temp\toolbox-upgrade-logs.txt 2>&1'), '', SW_HIDE, ewWaitUntilTerminated, ResultCode) + WizardForm.StatusLabel.Caption := 'Upgrading Docker Toolbox VM...' + ExecAsOriginalUser(ExpandConstant('{app}\docker-machine.exe'), 'stop default', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) if ResultCode = 0 then begin + FileCopy(ExpandConstant('{userdocs}\..\.docker\machine\cache\boot2docker.iso'), ExpandConstant('{userdocs}\..\.docker\machine\machines\default\boot2docker.iso'), false) TrackEvent('VM Upgrade Succeeded'); - MsgBox('Succcessfully migrated Boot2Docker VM to a Docker Machine VM named "default"', mbInformation, MB_OK); end else begin TrackEvent('VM Upgrade Failed'); - MsgBox('VM Upgrade VM failed. Please file an issue with the migration logs at https://github.com/docker/toolbox/issues/new.', mbCriticalError, MB_OK); - Exec(ExpandConstant('{win}\notepad.exe'), ExpandConstant('{localappdata}\Temp\toolbox-upgrade-logs.txt'), '', SW_SHOW, ewNoWait, ResultCode) + MsgBox('VM Upgrade Failed because the VirtualBox VM could not be stopped.', mbCriticalError, MB_OK); Result := false WizardForm.Close; exit; @@ -360,6 +346,23 @@ function MigrateVM() : Boolean; var ResultCode: Integer; begin + if NeedToInstallGit() or NeedToInstallVirtualBox() or not FileExists(ExpandConstant('{app}\docker-machine.exe')) then begin + Result := true + exit + end; + + ExecAsOriginalUser(VBoxPath() + 'VBoxManage.exe', 'showvminfo default', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) + if ResultCode <> 1 then begin + Result := true + exit + end; + + ExecAsOriginalUser(VBoxPath() + 'VBoxManage.exe', 'showvminfo boot2docker-vm', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) + if ResultCode <> 0 then begin + Result := true + exit + end; + if MsgBox('Migrate your existing Boot2Docker VM to work with the Docker Toolbox? Your existing Boot2Docker VM will not be affected. This should take about a minute.', mbConfirmation, MB_YESNO) = IDYES then begin TrackEvent('Boot2Docker Migration Started'); @@ -400,20 +403,6 @@ begin end; #include "modpath.iss" -procedure CurPageChanged(CurPageID: Integer); -begin - if (CurPageID = wpFinished) then - begin - WizardForm.FinishedLabel.AutoSize := True; - WizardForm.FinishedLabel.Font.Style := [fsBold]; - WizardForm.FinishedLabel.Caption := - 'Upgrade your default Docker VM using the command:' + \ - #13#10 + \ - #13#10 + \ - ' `docker-machine upgrade default`'; - end; -end; - procedure CurStepChanged(CurStep: TSetupStep); var Success: Boolean; @@ -425,11 +414,17 @@ begin ModPath(); if not WizardSilent() then begin - if CanUpgradeVM() then - Success := UpgradeVM(); - else if CanMigrateVM() then - Success := MigrateVM(); + if IsTaskSelected('upgradevm') then + begin + if CanUpgradeVM() then begin + Success := UpgradeVM(); + end + else begin + Success := MigrateVM(); + end; + end; end; + if Success then trackEvent('Installer Finished'); end;