mirror of https://github.com/docker/docs.git
Make quickstart script and migration script more defensible
This commit is contained in:
parent
5b1b8e69ed
commit
aee81588dd
Binary file not shown.
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
VM=default
|
VM=default
|
||||||
DOCKER_MACHINE=/usr/local/bin/docker-machine
|
DOCKER_MACHINE=/usr/local/bin/docker-machine
|
||||||
|
VBOXMANAGE=/Applications/VirtualBox.app/Contents/MacOS/VBoxManage
|
||||||
|
|
||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
|
|
@ -12,7 +13,12 @@ unset LD_LIBRARY_PATH
|
||||||
|
|
||||||
clear
|
clear
|
||||||
|
|
||||||
/usr/local/bin/VBoxManage showvminfo $VM &> /dev/null
|
if [ ! -f $DOCKER_MACHINE ] || [ ! -f $VBOXMANAGE ]; then
|
||||||
|
echo "Either VirtualBox or Docker Machine are not installed. Please re-run the Toolbox Installer and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
$VBOXMANAGE showvminfo $VM &> /dev/null
|
||||||
VM_EXISTS_CODE=$?
|
VM_EXISTS_CODE=$?
|
||||||
|
|
||||||
if [ $VM_EXISTS_CODE -ne 0 ]; then
|
if [ $VM_EXISTS_CODE -ne 0 ]; then
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,17 @@ chown -R $USER:admin /usr/local/bin/docker
|
||||||
chown -R $USER:admin /usr/local/bin/docker-machine
|
chown -R $USER:admin /usr/local/bin/docker-machine
|
||||||
chown -R $USER:admin /usr/local/bin/docker-compose
|
chown -R $USER:admin /usr/local/bin/docker-compose
|
||||||
|
|
||||||
# Migrate Boot2Docker VM
|
# Migrate Boot2Docker VM if VirtualBox is installed
|
||||||
BOOT2DOCKER_VM=boot2docker-vm
|
BOOT2DOCKER_VM=boot2docker-vm
|
||||||
VM=default
|
VM=default
|
||||||
|
|
||||||
sudo -u $USER /usr/local/bin/VBoxManage showvminfo $BOOT2DOCKER_VM &> /dev/null
|
VBOXMANAGE=/Applications/VirtualBox.app/Contents/MacOS/VBoxManage
|
||||||
|
|
||||||
|
if [ -f $VBOXMANAGE ] && [ -f /usr/local/bin/docker-machine ]; then
|
||||||
|
sudo -u $USER $VBOXMANAGE showvminfo $BOOT2DOCKER_VM &> /dev/null
|
||||||
BOOT2DOCKER_VM_EXISTS_CODE=$?
|
BOOT2DOCKER_VM_EXISTS_CODE=$?
|
||||||
|
|
||||||
sudo -u $USER /usr/local/bin/VBoxManage showvminfo $VM &> /dev/null
|
sudo -u $USER $VBOXMANAGE showvminfo $VM &> /dev/null
|
||||||
VM_EXISTS_CODE=$?
|
VM_EXISTS_CODE=$?
|
||||||
|
|
||||||
# Exit if there's no boot2docker vm, or the destination VM already exists
|
# Exit if there's no boot2docker vm, or the destination VM already exists
|
||||||
|
|
@ -45,6 +48,8 @@ if [ $BOOT2DOCKER_VM_EXISTS_CODE -eq 0 ] && [ $VM_EXISTS_CODE -ne 0 ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Open Applications dir if it exists and is not empty
|
# Open Applications dir if it exists and is not empty
|
||||||
if [ -d /Applications/Docker ] && [ "$(ls -A /Applications/Docker)" ]; then
|
if [ -d /Applications/Docker ] && [ "$(ls -A /Applications/Docker)" ]; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue