Minor Windows fixes

This commit is contained in:
Jeffrey Morgan 2015-08-10 23:25:08 -07:00
parent 3c7856a243
commit 83ed662cb2
4 changed files with 56 additions and 36 deletions

View File

@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Docker Toolbox" #define MyAppName "Docker Toolbox"
#define MyAppVersion "1.8.0-rc7" #define MyAppVersion "1.8.0-rc8"
#define MyAppPublisher "Docker" #define MyAppPublisher "Docker"
#define MyAppURL "https://docker.com" #define MyAppURL "https://docker.com"
#define MyAppContact "https://docs.docker.com" #define MyAppContact "https://docs.docker.com"
@ -33,7 +33,7 @@
; NOTE: The value of AppId uniquely identifies this application. ; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications. ; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{05BD04E9-4AB5-46AC-891E-60EA8FD57D56} AppId={{FC4417F0-D7F3-48DB-BCE1-F5ED5BAFFD91}
AppCopyright={#MyAppPublisher} AppCopyright={#MyAppPublisher}
AppContact={#MyAppContact} AppContact={#MyAppContact}
AppComments={#MyAppURL} AppComments={#MyAppURL}
@ -301,33 +301,43 @@ begin
MsgBox('File moving failed!', mbError, MB_OK); MsgBox('File moving failed!', mbError, MB_OK);
end; end;
procedure MigrateVM(); function MigrateVM() : Boolean;
var var
ResultCode: Integer; ResultCode: Integer;
begin begin
ExecAsOriginalUser('C:\Program Files\Oracle\VirtualBox\VBoxManage.exe', 'showvminfo default', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) ExecAsOriginalUser('C:\Program Files\Oracle\VirtualBox\VBoxManage.exe', 'showvminfo default', '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
if ResultCode <> 1 then if ResultCode <> 1 then
exit; begin
Result := true
exit
end;
ExecAsOriginalUser('C:\Program Files\Oracle\VirtualBox\VBoxManage.exe', 'showvminfo boot2docker-vm', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) ExecAsOriginalUser('C:\Program Files\Oracle\VirtualBox\VBoxManage.exe', 'showvminfo boot2docker-vm', '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
if ResultCode = 0 then if ResultCode <> 0 then
begin begin
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 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
WizardForm.StatusLabel.Caption := 'Migrating Boot2Docker VM...'
WizardForm.FilenameLabel.Caption := 'This will take a minute...'
DelTree(ExpandConstant('{userdocs}\..\.docker\machine\machines\default'), True, True, True);
ExecAsOriginalUser(ExpandConstant('{app}\migrate.bat'), ExpandConstant('> {localappdata}\Temp\toolbox-migration-logs.txt 2>&1'), '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
if ResultCode = 0 then
begin begin
WizardForm.StatusLabel.Caption := 'Migrating Boot2Docker VM...' MsgBox('Succcessfully migrated Boot2Docker VM to a Docker Machine VM named "default"', mbInformation, MB_OK);
WizardForm.FilenameLabel.Caption := 'This will take a minute...' end
if ExecAsOriginalUser(ExpandConstant('{app}\migrate.bat'), ExpandConstant('> {localappdata}\Temp\toolbox-migration-logs.txt'), '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then else begin
begin MsgBox('Migration of Boot2Docker VM failed. Please file an issue with the migration logs at https://github.com/docker/machine/issues/new.', mbCriticalError, MB_OK);
MsgBox('Succcessfully migrated Boot2Docker VM to a Docker Machine VM named "default"', mbInformation, MB_OK); Exec(ExpandConstant('{win}\notepad.exe'), ExpandConstant('{localappdata}\Temp\toolbox-migration-logs.txt'), '', SW_SHOW, ewNoWait, ResultCode)
end Result := false
else begin exit;
MsgBox('Migration of Boot2Docker VM failed. Please file an issue with the migration logs at https://github.com/docker/machine/issues/new.', mbInformation, MB_OK);
Exec(ExpandConstant('{win}\notepad.exe'), ExpandConstant('{localappdata}\Temp\toolbox-migration-logs.txt'), '', SW_SHOW, ewNoWait, ResultCode)
end
end; end;
end end;
end; Result := true
end;
const const
ModPathName = 'modifypath'; ModPathName = 'modifypath';
@ -344,22 +354,28 @@ procedure CurStepChanged(CurStep: TSetupStep);
var var
taskname: String; taskname: String;
WinHttpReq: Variant; WinHttpReq: Variant;
migrationSuccess: Boolean;
begin begin
taskname := ModPathName; taskname := ModPathName;
if CurStep = ssPostInstall then if CurStep = ssPostInstall then
begin begin
if IsComponentSelected('DockerMachine') then
MigrateVM();
try
WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpReq.Open('POST', 'https://api.mixpanel.com/track/?data={#EventFinishedData}', false);
WinHttpReq.SetRequestHeader('Content-Type', 'application/json');
WinHttpReq.Send('');
except
end;
if IsTaskSelected(taskname) then if IsTaskSelected(taskname) then
ModPath(); ModPath();
migrationSuccess:= true
if IsComponentSelected('DockerMachine') then
migrationSuccess := MigrateVM();
if migrationSuccess then
begin
try
WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpReq.Open('POST', 'https://api.mixpanel.com/track/?data={#EventFinishedData}', false);
WinHttpReq.SetRequestHeader('Content-Type', 'application/json');
WinHttpReq.Send('');
except
end;
end;
end end
end; end;

View File

@ -10,7 +10,7 @@ kitematic=0.8.0-rc5
vbox=5.0.0 vbox=5.0.0
vboxRev=101573 vboxRev=101573
msysGit=1.9.5-preview20150319 msysGit=1.9.5-preview20150319
installer=1.8.0-rc5 installer=1.8.0-rc8
mixpanel=c306ae65c33d7d09fe3e546f36493a6e mixpanel=c306ae65c33d7d09fe3e546f36493a6e
boot2dockerIsoSrc=tianon boot2dockerIsoSrc=tianon

View File

@ -1,3 +1,4 @@
#!/bin/bash #!/bin/bash
set -o pipefail
./docker-machine -D create -d virtualbox --virtualbox-import-boot2docker-vm boot2docker-vm default | sed -e '/BEGIN/,/END/d' ./docker-machine -D create -d virtualbox --virtualbox-import-boot2docker-vm boot2docker-vm default | sed -e '/BEGIN/,/END/d'

View File

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
set -e
trap '[ "$?" -eq 0 ] || read -p "Looks like something went wrong... Press any key to continue..."' EXIT trap '[ "$?" -eq 0 ] || read -p "Looks like something went wrong... Press any key to continue..."' EXIT
VM=default VM=default
@ -11,9 +9,14 @@ BLUE='\033[1;34m'
GREEN='\033[0;32m' GREEN='\033[0;32m'
NC='\033[0m' NC='\033[0m'
machine=$($DOCKER_MACHINE ls -q | grep "^$VM$") || : /c/Program\ Files/Oracle/VirtualBox/VBoxManage.exe showvminfo $VM &> /dev/null
if [ -z $machine ]; then VM_EXISTS_CODE=$?
set -e
if [ $VM_EXISTS_CODE -ne 0 ]; then
echo "Creating Machine $VM..." echo "Creating Machine $VM..."
rm -rf ~/.docker/machine/machines/$VM
$DOCKER_MACHINE create -d virtualbox --virtualbox-memory 2048 $VM $DOCKER_MACHINE create -d virtualbox --virtualbox-memory 2048 $VM
else else
echo "Machine $VM already exists." echo "Machine $VM already exists."