diff --git a/Dockerfile.osx b/Dockerfile.osx index 7680b505c7..4c4951a575 100644 --- a/Dockerfile.osx +++ b/Dockerfile.osx @@ -18,33 +18,35 @@ 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 - # Download the Docker parts -ENV DOCKER_VERSION 1.8.3 -RUN curl -fsSL -o /docker https://get.docker.com/builds/Darwin/x86_64/docker-$DOCKER_VERSION +ENV DOCKER_VERSION 1.9.0-rc1 +RUN curl -fsSL -o /docker https://test.docker.com/builds/Darwin/x86_64/docker-$DOCKER_VERSION RUN chmod +x /docker -ENV DOCKER_MACHINE_VERSION 0.4.1 -RUN curl -fsSL -o /docker-machine https://github.com/docker/machine/releases/download/v$DOCKER_MACHINE_VERSION/docker-machine_darwin-amd64 -RUN chmod +x /docker-machine +ENV DOCKER_MACHINE_VERSION 0.5.0-rc1 +RUN curl -fsSL -o /docker-machine.zip https://github.com/docker/machine/releases/download/v$DOCKER_MACHINE_VERSION/docker-machine_darwin-amd64.zip +RUN 7z x /docker-machine.zip && rm -f /docker-machine.zip +RUN chmod +x /docker-machine* -ENV DOCKER_COMPOSE_VERSION 1.4.2 +ENV DOCKER_COMPOSE_VERSION 1.5.0rc1 RUN curl -fsSL -o /docker-compose https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-Darwin-x86_64 RUN chmod +x /docker-compose ENV BOOT2DOCKER_ISO_VERSION $DOCKER_VERSION -RUN curl -fsSL -o /boot2docker.iso https://github.com/boot2docker/boot2docker/releases/download/v$DOCKER_VERSION/boot2docker.iso +# RUN curl -fsSL -o /boot2docker.iso https://github.com/boot2docker/boot2docker/releases/download/v$DOCKER_VERSION/boot2docker.iso +RUN curl -fsSL -o /boot2docker.iso https://github.com/tianon/boot2docker-legacy/releases/download/v$DOCKER_VERSION/boot2docker.iso -ENV KITEMATIC_VERSION 0.8.7 +ENV KITEMATIC_VERSION 0.9.0 RUN curl -fsSL -o /kitematic.zip https://github.com/kitematic/kitematic/releases/download/v$KITEMATIC_VERSION/Kitematic-$KITEMATIC_VERSION-Mac.zip -ENV INSTALLER_VERSION 1.8.3 +ENV INSTALLER_VERSION 1.9.0-rc1 ENV MIXPANEL_TOKEN c306ae65c33d7d09fe3e546f36493a6e @@ -112,7 +114,7 @@ RUN cd /mpkg/dockermachine.pkg && \ mkdir rootfs && \ cd rootfs && \ mkdir -p usr/local/bin && \ - mv /docker-machine usr/local/bin/ && \ + mv /docker-machine* usr/local/bin/ && \ ls -al /usr/local/bin/ && \ find . | cpio -o --format odc | gzip -c > ../Payload && \ mkbom . ../Bom && \ 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/Makefile b/Makefile index 2a7bd8d188..f823be8107 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,9 @@ DOCKER_WINDOWS_CONTAINER := build-windows-installer default: osx windows @true +clean: clean-osx clean-windows + @true + osx: clean-osx docker build -t $(DOCKER_OSX_IMAGE) -f Dockerfile.osx . docker run --name "$(DOCKER_OSX_CONTAINER)" "$(DOCKER_OSX_IMAGE)" diff --git a/osx/installerplugins/installerplugins.xcodeproj/project.pbxproj b/osx/installerplugins/installerplugins.xcodeproj/project.pbxproj index 6fe8b10f37..731d371134 100644 --- a/osx/installerplugins/installerplugins.xcodeproj/project.pbxproj +++ b/osx/installerplugins/installerplugins.xcodeproj/project.pbxproj @@ -53,7 +53,6 @@ 1B4C91C31B85198100A06068 /* InstallerSections.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = InstallerSections.plist; sourceTree = ""; }; 1B8417E71B85261F00B1FA4D /* kitematic.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = kitematic.png; sourceTree = ""; }; 1B8417E81B85261F00B1FA4D /* quickstart.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = quickstart.png; sourceTree = ""; }; - 1BB3EBCE1BA8C36000C2A3CF /* informationplugin.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = informationplugin.bundle; path = /Users/jmorgan/workspace/toolbox/osx/installerplugins/build/Debug/informationplugin.bundle; sourceTree = ""; }; 1BF102BB1B8BDEDA00FCB650 /* overviewplugin.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = overviewplugin.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 1BF102BE1B8BDEDA00FCB650 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 1BF102C01B8BDEDA00FCB650 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; @@ -80,13 +79,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 1BF1029B1B8B940500FCB650 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 1BF102B81B8BDEDA00FCB650 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -227,23 +219,6 @@ productReference = 1B4C91B31B85198100A06068 /* quickstartplugin.bundle */; productType = "com.apple.product-type.bundle"; }; - 1BF1029D1B8B940500FCB650 /* informationplugin */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1BF102B21B8B940500FCB650 /* Build configuration list for PBXNativeTarget "informationplugin" */; - buildPhases = ( - 1BF1029A1B8B940500FCB650 /* Sources */, - 1BF1029B1B8B940500FCB650 /* Frameworks */, - 1BF1029C1B8B940500FCB650 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = informationplugin; - productName = informationplugin; - productReference = 1BB3EBCE1BA8C36000C2A3CF /* informationplugin.bundle */; - productType = "com.apple.product-type.bundle"; - }; 1BF102BA1B8BDEDA00FCB650 /* overviewplugin */ = { isa = PBXNativeTarget; buildConfigurationList = 1BF102CD1B8BDEDA00FCB650 /* Build configuration list for PBXNativeTarget "overviewplugin" */; @@ -267,7 +242,7 @@ 1B4C906A1B84FDEB00A06068 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0640; + LastUpgradeCheck = 0700; ORGANIZATIONNAME = "Docker Inc"; TargetAttributes = { 1B4C91411B8500A700A06068 = { @@ -276,9 +251,6 @@ 1B4C91B21B85198100A06068 = { CreatedOnToolsVersion = 6.4; }; - 1BF1029D1B8B940500FCB650 = { - CreatedOnToolsVersion = 6.4; - }; 1BF102BA1B8BDEDA00FCB650 = { CreatedOnToolsVersion = 6.4; }; @@ -299,7 +271,6 @@ targets = ( 1B4C91411B8500A700A06068 /* managevmplugin */, 1B4C91B21B85198100A06068 /* quickstartplugin */, - 1BF1029D1B8B940500FCB650 /* informationplugin */, 1BF102BA1B8BDEDA00FCB650 /* overviewplugin */, ); }; @@ -333,13 +304,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 1BF1029C1B8B940500FCB650 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 1BF102B91B8BDEDA00FCB650 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -371,13 +335,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 1BF1029A1B8B940500FCB650 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 1BF102B71B8BDEDA00FCB650 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -484,6 +441,7 @@ COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -546,12 +504,14 @@ isa = XCBuildConfiguration; buildSettings = { COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = managevmplugin/Info.plist; INSTALL_PATH = "$(HOME)/Library/Bundles"; + PRODUCT_BUNDLE_IDENTIFIER = "com.docker.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = bundle; }; @@ -561,8 +521,10 @@ isa = XCBuildConfiguration; buildSettings = { COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = managevmplugin/Info.plist; INSTALL_PATH = "$(HOME)/Library/Bundles"; + PRODUCT_BUNDLE_IDENTIFIER = "com.docker.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = bundle; }; @@ -579,6 +541,7 @@ INFOPLIST_FILE = quickstartplugin/Info.plist; INSTALL_PATH = "$(HOME)/Library/Bundles"; MACOSX_DEPLOYMENT_TARGET = 10.8; + PRODUCT_BUNDLE_IDENTIFIER = "com.docker.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = bundle; }; @@ -592,35 +555,7 @@ INFOPLIST_FILE = quickstartplugin/Info.plist; INSTALL_PATH = "$(HOME)/Library/Bundles"; MACOSX_DEPLOYMENT_TARGET = 10.8; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = bundle; - }; - name = Release; - }; - 1BF102B01B8B940500FCB650 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = informationplugin/Info.plist; - INSTALL_PATH = "$(HOME)/Library/Bundles"; - MACOSX_DEPLOYMENT_TARGET = 10.8; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = bundle; - }; - name = Debug; - }; - 1BF102B11B8B940500FCB650 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - INFOPLIST_FILE = informationplugin/Info.plist; - INSTALL_PATH = "$(HOME)/Library/Bundles"; - MACOSX_DEPLOYMENT_TARGET = 10.8; + PRODUCT_BUNDLE_IDENTIFIER = "com.docker.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = bundle; }; @@ -637,6 +572,7 @@ INFOPLIST_FILE = overviewplugin/Info.plist; INSTALL_PATH = "$(HOME)/Library/Bundles"; MACOSX_DEPLOYMENT_TARGET = 10.8; + PRODUCT_BUNDLE_IDENTIFIER = "com.docker.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = bundle; }; @@ -650,6 +586,7 @@ INFOPLIST_FILE = overviewplugin/Info.plist; INSTALL_PATH = "$(HOME)/Library/Bundles"; MACOSX_DEPLOYMENT_TARGET = 10.8; + PRODUCT_BUNDLE_IDENTIFIER = "com.docker.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = bundle; }; @@ -685,15 +622,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 1BF102B21B8B940500FCB650 /* Build configuration list for PBXNativeTarget "informationplugin" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1BF102B01B8B940500FCB650 /* Debug */, - 1BF102B11B8B940500FCB650 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 1BF102CD1B8BDEDA00FCB650 /* Build configuration list for PBXNativeTarget "overviewplugin" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/osx/installerplugins/managevmplugin/Base.lproj/managevmplugin.xib b/osx/installerplugins/managevmplugin/Base.lproj/managevmplugin.xib index ff6c292727..0f950e5ea9 100644 --- a/osx/installerplugins/managevmplugin/Base.lproj/managevmplugin.xib +++ b/osx/installerplugins/managevmplugin/Base.lproj/managevmplugin.xib @@ -1,8 +1,8 @@ - + - + @@ -14,18 +14,16 @@ - - - - + + @@ -33,16 +31,6 @@ - - - - - - diff --git a/osx/installerplugins/managevmplugin/Info.plist b/osx/installerplugins/managevmplugin/Info.plist index ecc3c0e349..216ca414b8 100644 --- a/osx/installerplugins/managevmplugin/Info.plist +++ b/osx/installerplugins/managevmplugin/Info.plist @@ -2,16 +2,12 @@ - Mixpanel Token - %MIXPANEL_TOKEN% - Installer Version - %INSTALLER_VERSION% CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - com.docker.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -24,8 +20,12 @@ ???? CFBundleVersion 1 + Installer Version + %INSTALLER_VERSION% InstallerSectionTitle VM Migration + Mixpanel Token + %MIXPANEL_TOKEN% NSHumanReadableCopyright Copyright © 2015 Docker Inc. All rights reserved. NSMainNibFile diff --git a/osx/installerplugins/managevmplugin/managevmpluginPane.h b/osx/installerplugins/managevmplugin/managevmpluginPane.h index 31a6b5e3f0..5155fc4f07 100644 --- a/osx/installerplugins/managevmplugin/managevmpluginPane.h +++ b/osx/installerplugins/managevmplugin/managevmpluginPane.h @@ -10,18 +10,15 @@ @interface managevmpluginPane : InstallerPane -@property (weak) IBOutlet NSImageView *boot2dockerImage; -@property (weak) IBOutlet NSImageView *toolboxImage; +@property (weak) IBOutlet NSImageView *statusImage; @property (weak) IBOutlet NSButton *migrateCheckbox; @property (weak) IBOutlet NSTextField *migrateExtraLabel; @property (weak) IBOutlet NSProgressIndicator *migrationProgress; -@property (weak) IBOutlet NSImageView *arrowImage; -@property (weak) IBOutlet NSImageView *migrationStatusImage; @property (weak) IBOutlet NSTextField *migrationStatusLabel; @property (unsafe_unretained) IBOutlet NSTextView *migrationLogsTextView; @property (weak) IBOutlet NSScrollView *migrationLogsScrollView; -@property (weak) IBOutlet NSButton *issueButton; +@property (weak) IBOutlet NSButton *submitButton; -- (IBAction)issueButtonClicked:(id)sender; +- (IBAction)submitButtonClicked:(id)sender; @end diff --git a/osx/installerplugins/managevmplugin/managevmpluginPane.m b/osx/installerplugins/managevmplugin/managevmpluginPane.m index 0372a57e49..144c846613 100644 --- a/osx/installerplugins/managevmplugin/managevmpluginPane.m +++ b/osx/installerplugins/managevmplugin/managevmpluginPane.m @@ -10,8 +10,9 @@ #import "mixpanel.h" @interface managevmpluginPane() -@property BOOL migrating; -@property BOOL successfullyMigrated; +@property BOOL upgrading; +@property BOOL locked; +@property BOOL successful; @end @implementation managevmpluginPane @@ -25,6 +26,35 @@ NSString *dockerMachinePath = @"/usr/local/bin/docker-machine"; return [task terminationStatus] != 1; } +- (NSString *) boot2dockerISOVersionAtPath:(NSString*)path { + NSTask* task = [[NSTask alloc] init]; + task.arguments = [NSArray arrayWithObjects:path, nil]; + task.launchPath = @"/usr/bin/file"; + + NSPipe * out = [NSPipe pipe]; + [task setStandardOutput:out]; + [task launch]; + [task waitUntilExit]; + + if (task.terminationStatus != 0) { + return nil; + } + + NSFileHandle * read = [out fileHandleForReading]; + NSData * dataRead = [read readDataToEndOfFile]; + NSString * stringRead = [[NSString alloc] initWithData:dataRead encoding:NSUTF8StringEncoding]; + + NSCharacterSet *delimiters = [NSCharacterSet characterSetWithCharactersInString:@"v'"]; + NSArray *splitString = [stringRead componentsSeparatedByCharactersInSet:delimiters]; + + if (splitString.count < 3) { + return nil; + } + + NSString *version = [[splitString objectAtIndex:2] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; + return version; +} + - (BOOL) canMigrateBoot2DockerVM { // VirtualBox and Docker Machine exist if (![[NSFileManager defaultManager] fileExistsAtPath:vBoxManagePath] || ![[NSFileManager defaultManager] fileExistsAtPath:dockerMachinePath]) { @@ -50,11 +80,32 @@ NSString *dockerMachinePath = @"/usr/local/bin/docker-machine"; return YES; } +- (BOOL) canUpgradeBoot2DockerVM { + // VirtualBox and Docker Machine exist + if (![[NSFileManager defaultManager] fileExistsAtPath:vBoxManagePath] || ![[NSFileManager defaultManager] fileExistsAtPath:dockerMachinePath]) { + return NO; + } + + // docker-machine path and VirtualBox VM exist + if (![self vmExists:@"default"] || + ![[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/.docker/machine/machines/default", NSHomeDirectory()]] || + ![[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/.docker/machine/machines/default/boot2docker.iso", NSHomeDirectory()]]) { + return NO; + } + + NSString *incomingVersion = [self boot2dockerISOVersionAtPath:[NSString stringWithFormat:@"%@/.docker/machine/cache/boot2docker.iso", NSHomeDirectory()]]; + NSString *existingVersion = [self boot2dockerISOVersionAtPath:[NSString stringWithFormat:@"%@/.docker/machine/machines/default/boot2docker.iso", NSHomeDirectory()]]; + + NSLog(@"%@", incomingVersion); + NSLog(@"%@", existingVersion); + + return [incomingVersion compare:existingVersion options:NSNumericSearch] != NSOrderedAscending; +} + - (void) migrateBoot2DockerVM { + self.locked = YES; - self.migrating = YES; - - // Remove existing vm if it exists (obviously user must have deleted the + // Remove existing vm if it exists NSTask* removeVMTask = [NSTask launchedTaskWithLaunchPath:@"/usr/bin/sudo" arguments:[NSArray arrayWithObjects:@"-i", @"-u", NSUserName(), dockerMachinePath, @"rm", @"-f", @"default", nil]]; [removeVMTask waitUntilExit]; @@ -67,6 +118,68 @@ NSString *dockerMachinePath = @"/usr/local/bin/docker-machine"; migrateTask.launchPath = @"/usr/bin/sudo"; migrateTask.arguments = [NSArray arrayWithObjects:@"-i", @"-u", NSUserName(), dockerMachinePath, @"-D", @"create", @"-d", @"virtualbox", @"--virtualbox-memory", @"2048", @"--virtualbox-import-boot2docker-vm", @"boot2docker-vm", @"default", nil]; + + [self runTask:migrateTask onFinish:^void (int status) { + self.nextEnabled = YES; + self.statusImage.hidden = YES; + [self.migrationProgress stopAnimation:self]; + self.migrationProgress.hidden = YES; + + self.migrationStatusLabel.hidden = NO; + self.statusImage.hidden = NO; + + if (status == 0) { + self.successful = YES; + self.migrationStatusLabel.stringValue = @"Your Boot2Docker VM was successfully migrated to a Docker Machine VM named \"default\"."; + self.statusImage.image = [[NSImage alloc]initWithContentsOfFile:[[NSBundle bundleForClass:[self class]] pathForResource:@"toolboxcheck" ofType:@"png"]]; + [Mixpanel trackEvent:@"Boot2Docker Migration Succeeded" forPane:self]; + [self gotoNextPane]; + } else { + self.migrationLogsScrollView.hidden = NO; + self.submitButton.hidden = NO; + [Mixpanel trackEvent:@"Boot2Docker Migration Failed" forPane:self]; + self.migrationStatusLabel.hidden = NO; + self.migrationStatusLabel.stringValue = @"Creating the VM failed. Following the install, try creating a vm manually via docker-machine."; + } + + }]; +} + +- (void) upgradeBoot2DockerVM { + self.locked = YES; + + // Do the migration + NSTask* task = [[NSTask alloc] init]; + task.launchPath = @"/usr/bin/sudo"; + task.arguments = [NSArray arrayWithObjects:@"-i", @"-u", NSUserName(), [NSString stringWithFormat:@"%@ stop default && cp %@/.docker/machine/cache/boot2docker.iso %@/.docker/machine/machines/default/boot2docker.iso", dockerMachinePath, NSHomeDirectory(), NSHomeDirectory()], nil]; + + [self runTask:task onFinish:^void (int status) { + self.nextEnabled = YES; + self.statusImage.hidden = YES; + [self.migrationProgress stopAnimation:self]; + self.migrationProgress.hidden = YES; + + self.migrationStatusLabel.hidden = NO; + self.statusImage.hidden = NO; + + if (status == 0) { + self.successful = YES; + self.migrationStatusLabel.stringValue = @"Your VirtualBox Docker VM named \"default\" was successfully upgraded."; + self.statusImage.image = [[NSImage alloc]initWithContentsOfFile:[[NSBundle bundleForClass:[self class]] pathForResource:@"toolboxcheck" ofType:@"png"]]; + [Mixpanel trackEvent:@"VM Upgrade Succeeded" forPane:self]; + [self gotoNextPane]; + } else { + self.migrationLogsScrollView.hidden = NO; + self.submitButton.hidden = NO; + [Mixpanel trackEvent:@"VM Upgrade Failed" forPane:self]; + self.migrationStatusLabel.hidden = NO; + self.migrationStatusLabel.stringValue = @"Upgrading your VirtualBox Docker VM Failed. Try upgrading again manually via the docker-machine command."; + } + + }]; +} + +- (void) runTask:(NSTask *)task onFinish:(void (^)(int))finish { // Remove certificates, ssh keys from logs NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"BEGIN.*END" options:NSRegularExpressionDotMatchesLineSeparators error:NULL]; NSFont *font = [NSFont fontWithName:@"Menlo" size:10.0]; @@ -84,48 +197,26 @@ NSString *dockerMachinePath = @"/usr/local/bin/docker-machine"; [self.migrationLogsTextView scrollRangeToVisible:NSMakeRange([[self.migrationLogsTextView string] length], 0)]; }); }; - - migrateTask.standardOutput = [NSPipe pipe]; - migrateTask.standardError = [NSPipe pipe]; - [[migrateTask.standardOutput fileHandleForReading] setReadabilityHandler:appendOutput]; - [[migrateTask.standardError fileHandleForReading] setReadabilityHandler:appendOutput]; + task.standardOutput = [NSPipe pipe]; + task.standardError = [NSPipe pipe]; - migrateTask.terminationHandler = ^(NSTask* task) { + [[task.standardOutput fileHandleForReading] setReadabilityHandler:appendOutput]; + [[task.standardError fileHandleForReading] setReadabilityHandler:appendOutput]; + + task.terminationHandler = ^(NSTask* task) { dispatch_async(dispatch_get_main_queue(), ^{ [task.standardOutput fileHandleForReading].readabilityHandler = nil; - - self.boot2dockerImage.hidden = YES; - self.toolboxImage.hidden = YES; - [self.migrationProgress stopAnimation:self]; - self.migrationProgress.hidden = YES; - - self.migrationStatusLabel.hidden = NO; - self.migrationStatusImage.hidden = NO; - - if (task.terminationStatus == 0) { - self.successfullyMigrated = YES; - self.migrationStatusLabel.stringValue = @"Your Boot2Docker VM was successfully migrated to a Docker Machine VM named \"default\"."; - self.migrationStatusImage.image = [[NSImage alloc]initWithContentsOfFile:[[NSBundle bundleForClass:[self class]] pathForResource:@"toolboxcheck" ofType:@"png"]]; - [Mixpanel trackEvent:@"Boot2Docker Migration Succeeded" forPane:self]; - self.nextEnabled = YES; - [self gotoNextPane]; - } else { - self.migrationLogsScrollView.hidden = NO; - self.issueButton.hidden = NO; - [Mixpanel trackEvent:@"Boot2Docker Migration Failed" forPane:self]; - self.migrationStatusLabel.hidden = NO; - self.migrationStatusLabel.stringValue = @"VM Migration failed. Please see the logs below."; - } + finish(task.terminationStatus); }); }; - [migrateTask launch]; + [task launch]; } - (id) init { - self.migrating = NO; - self.successfullyMigrated = NO; + self.upgrading = NO; + self.successful = NO; self = [super init]; return self; } @@ -136,34 +227,30 @@ NSString *dockerMachinePath = @"/usr/local/bin/docker-machine"; - (void) didEnterPane:(InstallerSectionDirection)dir { [Mixpanel trackEvent:@"Installing Files Succeeded" forPane:self]; - if (self.successfullyMigrated) { - self.nextEnabled = YES; - return; - } - - if (self.migrating) { - self.nextEnabled = NO; - return; - } + self.previousEnabled = NO; + NSImage *toolboxImage = [[NSImage alloc]initWithContentsOfFile:[[NSBundle bundleForClass:[self class]] pathForResource:@"toolbox" ofType:@"png"]]; + NSImage *boot2dockerImage = [[NSImage alloc] initWithContentsOfFile:[[NSBundle bundleForClass:[self class]] pathForResource:@"boot2docker" ofType:@"png"]]; + [self.migrationProgress startAnimation:self]; - - if ([self canMigrateBoot2DockerVM]) { - NSImage *image = [[NSImage alloc] initWithContentsOfFile:[[NSBundle bundleForClass:[self class]] pathForResource:@"boot2docker" ofType:@"png"]]; - self.boot2dockerImage.image = image; - self.boot2dockerImage.hidden = NO; - NSImage *toolboxImage = [[NSImage alloc]initWithContentsOfFile:[[NSBundle bundleForClass:[self class]] pathForResource:@"toolbox" ofType:@"png"]]; - self.toolboxImage.image = toolboxImage; - self.toolboxImage.hidden = NO; - self.arrowImage.hidden = NO; - self.migrateCheckbox.hidden = NO; - self.migrateCheckbox.enabled = YES; - self.migrateExtraLabel.hidden = NO; - [self.migrationProgress stopAnimation:self]; - self.migrationProgress.hidden = YES; + + if ([self canUpgradeBoot2DockerVM]) { + self.migrateCheckbox.title = [NSString stringWithFormat:@"Upgrade your Docker Toolbox VM to Docker %@", [self boot2dockerISOVersionAtPath:[NSString stringWithFormat:@"%@/.docker/machine/cache/boot2docker.iso", NSHomeDirectory()]]] ; + self.migrateExtraLabel.stringValue = @"Your existing Docker Toolbox VM will not be affected. This should take about a minute."; + self.statusImage.image = toolboxImage; + self.upgrading = YES; + } else if ([self canMigrateBoot2DockerVM]) { + self.statusImage.image = boot2dockerImage; } else { [self gotoNextPane]; } + + self.statusImage.hidden = NO; + self.migrateCheckbox.hidden = NO; + self.migrateCheckbox.enabled = YES; + self.migrateExtraLabel.hidden = NO; + self.migrationProgress.hidden = YES; + [self.migrationProgress stopAnimation:self]; } - (BOOL) shouldExitPane:(InstallerSectionDirection)dir { @@ -172,27 +259,38 @@ NSString *dockerMachinePath = @"/usr/local/bin/docker-machine"; } if (self.migrateCheckbox.enabled && self.migrateCheckbox.state == NSOnState) { - [Mixpanel trackEvent:@"Boot2Docker Migration Started" forPane:self]; - self.nextEnabled = false; self.migrationProgress.hidden = NO; - [self.migrationProgress startAnimation:self]; self.migrationStatusLabel.hidden = NO; - self.arrowImage.hidden = YES; self.migrateCheckbox.enabled = NO; - self.migrationStatusLabel.stringValue = @"Migrating..."; + [self.migrationProgress startAnimation:self]; + + if (self.upgrading) { + [Mixpanel trackEvent:@"VM Upgrade Started" forPane:self]; + self.migrationStatusLabel.stringValue = @"Upgrading..."; + [self upgradeBoot2DockerVM]; + } else { + [Mixpanel trackEvent:@"Boot2Docker Migration Started" forPane:self]; + self.migrationStatusLabel.stringValue = @"Migrating..."; + [self migrateBoot2DockerVM]; + } - [self migrateBoot2DockerVM]; return NO; } else if (self.migrateCheckbox.state == NSOffState) { - [Mixpanel trackEvent:@"Boot2Docker Migration Skipped" forPane:self]; + if (self.upgrading) { + [Mixpanel trackEvent:@"VM Upgrade Skipped" forPane:self]; + } else { + [Mixpanel trackEvent:@"Boot2Docker Migration Skipped" forPane:self]; + } + } + return YES; } - -- (IBAction)issueButtonClicked:(id)sender { +- (IBAction)submitButtonClicked:(id)sender { NSURL *url = [[NSURL alloc] initWithString: @"https://github.com/docker/toolbox/issues"]; [[NSWorkspace sharedWorkspace] openURL:url]; } + @end diff --git a/osx/installerplugins/overviewplugin/Info.plist b/osx/installerplugins/overviewplugin/Info.plist index 4d99e86ca6..6bec75d275 100644 --- a/osx/installerplugins/overviewplugin/Info.plist +++ b/osx/installerplugins/overviewplugin/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - com.docker.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -20,17 +20,17 @@ ???? CFBundleVersion 1 + Installer Version + %INSTALLER_VERSION% InstallerSectionTitle Overview + Mixpanel Token + %MIXPANEL_TOKEN% NSHumanReadableCopyright Copyright © 2015 Docker Inc. All rights reserved. NSMainNibFile overviewplugin NSPrincipalClass InstallerSection - Installer Version - %INSTALLER_VERSION% - Mixpanel Token - %MIXPANEL_TOKEN% diff --git a/osx/installerplugins/overviewplugin/overviewpluginPane.m b/osx/installerplugins/overviewplugin/overviewpluginPane.m index 1f67f26608..969e0f239b 100644 --- a/osx/installerplugins/overviewplugin/overviewpluginPane.m +++ b/osx/installerplugins/overviewplugin/overviewpluginPane.m @@ -41,18 +41,16 @@ if (dir != InstallerDirectionForward) { return; } - - [Mixpanel trackEvent:@"Continued from Overview" forPane:self]; -} - -- (IBAction)checkboxChanged:(id)sender { - if ([(NSButton*)sender state] == NSOnState) { - [Mixpanel trackEvent:@"Enabled Tracking" forPane:self]; - [[[self section] sharedDictionary] removeObjectForKey:@"disableTracking"]; - } else { - [Mixpanel trackEvent:@"Disabled Tracking" forPane:self]; + + BOOL enabled = self.checkbox.state == NSOnState; + [Mixpanel trackEvent:@"Continued from Overview" forPane:self withProperties:[[NSDictionary alloc] initWithObjectsAndKeys:enabled ? @"Yes" : @"No", @"Tracking Enabled", nil]]; + + if (!enabled) { [[[self section] sharedDictionary] setObject:[NSNumber numberWithBool:YES] forKey:@"disableTracking"]; + } else { + [[[self section] sharedDictionary] removeObjectForKey:@"disableTracking"]; } + } @end diff --git a/osx/installerplugins/quickstartplugin/Base.lproj/quickstartplugin.xib b/osx/installerplugins/quickstartplugin/Base.lproj/quickstartplugin.xib index 1d1dcd51ca..4a2fbe906d 100644 --- a/osx/installerplugins/quickstartplugin/Base.lproj/quickstartplugin.xib +++ b/osx/installerplugins/quickstartplugin/Base.lproj/quickstartplugin.xib @@ -1,8 +1,8 @@ - + - + diff --git a/osx/installerplugins/quickstartplugin/Info.plist b/osx/installerplugins/quickstartplugin/Info.plist index e0eb5c554f..09dd23f8db 100644 --- a/osx/installerplugins/quickstartplugin/Info.plist +++ b/osx/installerplugins/quickstartplugin/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - com.docker.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -20,17 +20,17 @@ ???? CFBundleVersion 1 + Installer Version + %INSTALLER_VERSION% InstallerSectionTitle quickstartplugin + Mixpanel Token + %MIXPANEL_TOKEN% NSHumanReadableCopyright Copyright © 2015 Docker Inc. All rights reserved. NSMainNibFile quickstartplugin NSPrincipalClass InstallerSection - Installer Version - %INSTALLER_VERSION% - Mixpanel Token - %MIXPANEL_TOKEN% diff --git a/osx/mpkg/Distribution b/osx/mpkg/Distribution index 678406f4f9..68f2053745 100644 --- a/osx/mpkg/Distribution +++ b/osx/mpkg/Distribution @@ -4,7 +4,6 @@ - diff --git a/osx/mpkg/Plugins/managevmplugin.bundle/Contents/Info.plist b/osx/mpkg/Plugins/managevmplugin.bundle/Contents/Info.plist index 765522f254..63a8d4312f 100644 --- a/osx/mpkg/Plugins/managevmplugin.bundle/Contents/Info.plist +++ b/osx/mpkg/Plugins/managevmplugin.bundle/Contents/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 15A282b + 15B38b CFBundleDevelopmentRegion en CFBundleExecutable @@ -20,22 +20,26 @@ 1.0 CFBundleSignature ???? + CFBundleSupportedPlatforms + + MacOSX + CFBundleVersion 1 DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 6E35b + 7A1001 DTPlatformVersion GM DTSDKBuild - 14D125 + 15A278 DTSDKName - macosx10.10 + macosx10.11 DTXcode - 0640 + 0701 DTXcodeBuild - 6E35b + 7A1001 Installer Version %INSTALLER_VERSION% InstallerSectionTitle diff --git a/osx/mpkg/Plugins/managevmplugin.bundle/Contents/MacOS/managevmplugin b/osx/mpkg/Plugins/managevmplugin.bundle/Contents/MacOS/managevmplugin index e09e47b54c..8624f7df22 100755 Binary files a/osx/mpkg/Plugins/managevmplugin.bundle/Contents/MacOS/managevmplugin and b/osx/mpkg/Plugins/managevmplugin.bundle/Contents/MacOS/managevmplugin differ diff --git a/osx/mpkg/Plugins/managevmplugin.bundle/Contents/Resources/Base.lproj/managevmplugin.nib b/osx/mpkg/Plugins/managevmplugin.bundle/Contents/Resources/Base.lproj/managevmplugin.nib index 9b338b6a04..6d999381d1 100644 Binary files a/osx/mpkg/Plugins/managevmplugin.bundle/Contents/Resources/Base.lproj/managevmplugin.nib and b/osx/mpkg/Plugins/managevmplugin.bundle/Contents/Resources/Base.lproj/managevmplugin.nib differ diff --git a/osx/mpkg/Plugins/overviewplugin.bundle/Contents/Info.plist b/osx/mpkg/Plugins/overviewplugin.bundle/Contents/Info.plist index 1328978c94..c7e2d52600 100644 --- a/osx/mpkg/Plugins/overviewplugin.bundle/Contents/Info.plist +++ b/osx/mpkg/Plugins/overviewplugin.bundle/Contents/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 15A279b + 15B38b CFBundleDevelopmentRegion en CFBundleExecutable @@ -20,22 +20,26 @@ 1.0 CFBundleSignature ???? + CFBundleSupportedPlatforms + + MacOSX + CFBundleVersion 1 DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 6E35b + 7A1001 DTPlatformVersion GM DTSDKBuild - 14D125 + 15A278 DTSDKName - macosx10.10 + macosx10.11 DTXcode - 0640 + 0701 DTXcodeBuild - 6E35b + 7A1001 Installer Version %INSTALLER_VERSION% InstallerSectionTitle diff --git a/osx/mpkg/Plugins/overviewplugin.bundle/Contents/MacOS/overviewplugin b/osx/mpkg/Plugins/overviewplugin.bundle/Contents/MacOS/overviewplugin index 7eab5ba2f0..4ce1ac1b11 100755 Binary files a/osx/mpkg/Plugins/overviewplugin.bundle/Contents/MacOS/overviewplugin and b/osx/mpkg/Plugins/overviewplugin.bundle/Contents/MacOS/overviewplugin differ diff --git a/osx/mpkg/Plugins/quickstartplugin.bundle/Contents/Info.plist b/osx/mpkg/Plugins/quickstartplugin.bundle/Contents/Info.plist index 91edcc43a6..5fa45e0483 100644 --- a/osx/mpkg/Plugins/quickstartplugin.bundle/Contents/Info.plist +++ b/osx/mpkg/Plugins/quickstartplugin.bundle/Contents/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 15A279b + 15B38b CFBundleDevelopmentRegion en CFBundleExecutable @@ -20,22 +20,26 @@ 1.0 CFBundleSignature ???? + CFBundleSupportedPlatforms + + MacOSX + CFBundleVersion 1 DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 6E35b + 7A1001 DTPlatformVersion GM DTSDKBuild - 14D125 + 15A278 DTSDKName - macosx10.10 + macosx10.11 DTXcode - 0640 + 0701 DTXcodeBuild - 6E35b + 7A1001 Installer Version %INSTALLER_VERSION% InstallerSectionTitle diff --git a/osx/mpkg/Plugins/quickstartplugin.bundle/Contents/MacOS/quickstartplugin b/osx/mpkg/Plugins/quickstartplugin.bundle/Contents/MacOS/quickstartplugin index d185c856ed..60dfa331d2 100755 Binary files a/osx/mpkg/Plugins/quickstartplugin.bundle/Contents/MacOS/quickstartplugin and b/osx/mpkg/Plugins/quickstartplugin.bundle/Contents/MacOS/quickstartplugin differ diff --git a/osx/mpkg/Resources/en.lproj/Localizable.strings b/osx/mpkg/Resources/en.lproj/Localizable.strings index 87bd734848..a2fde91096 100644 --- a/osx/mpkg/Resources/en.lproj/Localizable.strings +++ b/osx/mpkg/Resources/en.lproj/Localizable.strings @@ -4,7 +4,7 @@ 'choiceDockerCLI_msg' = 'Installs the Docker Client for Mac OS X into /usr/local/bin/'; 'choiceDockerMachineCLI_title' = 'Docker Machine %DOCKERMACHINE_VERSION%'; -'choiceDockerMachineCLI_msg' = 'Installs the Docker Machine binary into /usr/local/bin/'; +'choiceDockerMachineCLI_msg' = 'Installs the Docker Machine binaries into /usr/local/bin/'; 'choiceDockerComposeCLI_title' = 'Docker Compose %DOCKERCOMPOSE_VERSION%'; 'choiceDockerComposeCLI_msg' = 'Installs the Docker Compose binary into /usr/local/bin/'; diff --git a/osx/mpkg/boot2dockeriso.pkg/Scripts/postinstall b/osx/mpkg/boot2dockeriso.pkg/Scripts/postinstall index 5f7a85f5b5..5494943a71 100755 --- a/osx/mpkg/boot2dockeriso.pkg/Scripts/postinstall +++ b/osx/mpkg/boot2dockeriso.pkg/Scripts/postinstall @@ -10,5 +10,5 @@ chown -R $CONSOLE_USER:staff $CONSOLE_USER_HOME/.docker # Fix permissions on binaries chown -R $CONSOLE_USER:admin /usr/local/bin/docker || true -chown -R $CONSOLE_USER:admin /usr/local/bin/docker-machine || true +chown -R $CONSOLE_USER:admin /usr/local/bin/docker-machine* || true chown -R $CONSOLE_USER:admin /usr/local/bin/docker-compose || true diff --git a/windows/Toolbox.iss b/windows/Toolbox.iss index d86d507601..2b628be3fb 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,26 +297,71 @@ begin MsgBox('File moving failed!', mbError, MB_OK); end; +function CanUpgradeVM(): Boolean; +var + ResultCode: Integer; +begin + if NeedToInstallVirtualBox() or not FileExists(ExpandConstant('{app}\docker-machine.exe')) then begin + Result := false + exit + end; + + 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\machines\default')) then begin + Result := false + exit + end; + + Result := true +end; + +function UpgradeVM() : Boolean; +var + ResultCode: Integer; +begin + TrackEvent('VM Upgrade Started'); + 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'); + end + else begin + TrackEvent('VM Upgrade Failed'); + MsgBox('VM Upgrade Failed because the VirtualBox VM could not be stopped.', mbCriticalError, MB_OK); + Result := false + WizardForm.Close; + exit; + end; + Result := true +end; + 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; + if NeedToInstallGit() or NeedToInstallVirtualBox() or not FileExists(ExpandConstant('{app}\docker-machine.exe')) then begin + Result := true + exit + end; - ExecAsOriginalUser('C:\Program Files\Oracle\VirtualBox\VBoxManage.exe', 'showvminfo default', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) - if ResultCode <> 1 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('C:\Program Files\Oracle\VirtualBox\VBoxManage.exe', 'showvminfo boot2docker-vm', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) - if ResultCode <> 0 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 @@ -348,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; @@ -372,7 +413,18 @@ begin if IsTaskSelected(ModPathName) then ModPath(); if not WizardSilent() then - Success := MigrateVM(); + begin + 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;