From 74a1fde80280dd59011838f2e43c225566d5e051 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 11 Aug 2015 08:14:32 -0700 Subject: [PATCH] Minor osx shell fixes Signed-off-by: Jeffrey Morgan --- osx/Dockerfile | 2 +- .../Contents/Resources/Scripts/start.sh | 10 +++++++--- osx/mpkg/boot2dockeriso.pkg/Scripts/postinstall | 8 ++++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/osx/Dockerfile b/osx/Dockerfile index a159eb7c..624f4cb1 100644 --- a/osx/Dockerfile +++ b/osx/Dockerfile @@ -45,7 +45,7 @@ ENV KITEMATIC_VERSION 0.8.0-rc5 RUN curl -fsSL -o /kitematic.zip https://github.com/kitematic/kitematic/releases/download/v$KITEMATIC_VERSION/Kitematic-$KITEMATIC_VERSION-Mac.zip # ENV INSTALLER_VERSION $DOCKER_VERSION -ENV INSTALLER_VERSION 1.8.0-rc7 +ENV INSTALLER_VERSION 1.8.0-rc8 ENV MIXPANEL_TOKEN c306ae65c33d7d09fe3e546f36493a6e diff --git a/osx/mpkg/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh b/osx/mpkg/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh index 68974a79..180043f0 100755 --- a/osx/mpkg/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh +++ b/osx/mpkg/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh @@ -12,10 +12,14 @@ unset LD_LIBRARY_PATH clear -machine=$($DOCKER_MACHINE ls -q | grep "^$VM$") || : -if [ -z $machine ]; then +/usr/local/bin/VBoxManage showvminfo $VM &> /dev/null +VM_EXISTS_CODE=$? + +if [ $VM_EXISTS_CODE -ne 0 ]; then echo "Creating Machine $VM..." - $DOCKER_MACHINE create -d virtualbox --virtualbox-memory 2048 $VM + $DOCKER_MACHINE rm -f $VM &> /dev/null + rm -rf ~/.docker/machine/machines/$VM + $DOCKER_MACHINE create -d virtualbox --virtualbox-memory 2048 $VM else echo "Machine $VM already exists." fi diff --git a/osx/mpkg/boot2dockeriso.pkg/Scripts/postinstall b/osx/mpkg/boot2dockeriso.pkg/Scripts/postinstall index eb7db61e..c8986ad8 100755 --- a/osx/mpkg/boot2dockeriso.pkg/Scripts/postinstall +++ b/osx/mpkg/boot2dockeriso.pkg/Scripts/postinstall @@ -24,11 +24,15 @@ VM_EXISTS_CODE=$? # Exit if there's no boot2docker vm, or the destination VM already exists if [ $BOOT2DOCKER_VM_EXISTS_CODE -eq 0 ] && [ $VM_EXISTS_CODE -ne 0 ]; then - # Prompt the user to migrate osascript -e 'tell app "System Events" to display dialog "Migrate your existing Boot2Docker VM to work with the Docker Toolbox?\n \nYour existing Boot2Docker VM will not be affected. This should take about a minute." buttons {"Do not Migrate", "Migrate"} default button 2 cancel button 1 with icon 2 with title "Migrate Boot2Docker VM?"' if [ $? -eq 0 ]; then - rm -rf ~/.docker/machine/machines/default + + # Clear out any existing VM data in case the user deleted the VM manually via VirtualBox + /usr/local/bin/docker-machine rm -f $VM &> /dev/null + rm -rf ~/.docker/machine/machines/$VM + + # Run migration, opening logs if it fails sudo -u $USER PATH=/Applications/VirtualBox.app/Contents/MacOS/:$PATH /usr/local/bin/docker-machine -D create -d virtualbox --virtualbox-import-boot2docker-vm $BOOT2DOCKER_VM $VM 2>&1 | sed -e '/BEGIN/,/END/d' > /tmp/toolbox-migration-logs.txt if [ $? -eq 0 ]; then osascript -e 'tell app "System Events" to display dialog "Boot2Docker VM migrated successfully to a Docker Machine VM named \"default\"" buttons {"Ok"} default button 1'