Minor osx shell fixes

Signed-off-by: Jeffrey Morgan <jmorganca@gmail.com>
This commit is contained in:
Jeffrey Morgan 2015-08-11 08:14:32 -07:00
parent d54a3ccde0
commit 74a1fde802
3 changed files with 14 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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'