kitematic/util/deps

37 строки
1.4 KiB
Bash
Executable File

#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BASE=$DIR/..
DOCKER_MACHINE_CLI_VERSION=$(node -pe "JSON.parse(process.argv[1])['docker-machine-version']" "$(cat $BASE/package.json)")
DOCKER_MACHINE_CLI_FILE=docker-machine-$DOCKER_MACHINE_CLI_VERSION
DOCKER_VERSION=$(node -pe "JSON.parse(process.argv[1])['docker-version']" "$(cat $BASE/package.json)")
DOCKER_CLI_FILE=docker-$DOCKER_VERSION
BOOT2DOCKER_FILE=boot2docker-$DOCKER_VERSION.iso
pushd $BASE/resources > /dev/null
if [ ! -f $DOCKER_CLI_FILE ]; then
echo "-----> Downloading Docker CLI..."
rm -rf docker-*
curl -L -o docker-$DOCKER_VERSION.tgz https://get.docker.com/builds/Darwin/x86_64/docker-$DOCKER_VERSION.tgz
tar xvzf docker-$DOCKER_VERSION.tgz --strip=3
rm docker-$DOCKER_VERSION.tgz
mv docker docker-$DOCKER_VERSION
chmod +x $DOCKER_VERSION
fi
if [ ! -f $DOCKER_MACHINE_CLI_FILE ]; then
echo "-----> Downloading Docker Machine CLI..."
rm -rf docker-machine*
curl -L -o $DOCKER_MACHINE_CLI_FILE https://github.com/docker/machine/releases/download/v$DOCKER_MACHINE_CLI_VERSION/docker-machine_darwin-amd64
chmod +x $DOCKER_MACHINE_CLI_FILE
fi
if [ ! -f $BOOT2DOCKER_FILE ]; then
echo "-----> Downloading Boot2Docker iso..."
rm -rf boot2docker-*
curl -L -o $BOOT2DOCKER_FILE https://github.com/boot2docker/boot2docker/releases/download/v$DOCKER_VERSION/boot2docker.iso
fi
popd > /dev/null