Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ailispaw committed Jul 14, 2017
1 parent d57f806 commit e33e25f
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions overlay/etc/init.d/docker
Original file line number Diff line number Diff line change
Expand Up @@ -205,19 +205,15 @@ switch() {
DOCKER_SWITCHING=true
return
elif [ "${version}" = "latest" ]; then
version=$(wget -qO- https://api.github.com/repos/docker/docker-ce/releases/latest \
version=$(wget -qO- https://api.github.com/repos/bargees/aarch64-docker/releases/latest \
| awk -F'"' '/tag_name/ { print $4 }')
if [ "${version}" = "" ]; then
version=$(wget -qO- https://api.github.com/repos/bargees/armhf-docker/releases/latest \
| awk -F'"' '/tag_name/ { print $4 }')
fi
fi

version="${version/#v/}"

DOCKER_BIN_DIR="/opt/docker/v${version}"

local base_url="https://github.com/bargees/armhf-docker/releases/download/v${version}"
local base_url="https://github.com/bargees/aarch64-docker/releases/download/v${version}"

local versions=($(echo ${version} | tr -s '.' ' '))
if [[ ${versions[0]} -lt 1 ]]; then
Expand All @@ -240,15 +236,6 @@ switch() {
if [[ (${versions[0]} -gt 17) || (${versions[1]} -ge 6) ]]; then
docker_repo="docker/docker-ce"
completion="components/engine/contrib/completion/bash/docker"

local channel="edge"
if ! ((${versions[1]} % 3)); then
channel="stable"
fi
if [[ "${version}" == *"-rc"* ]]; then
channel="test"
fi
base_url="https://download.docker.com/linux/static/${channel}/armhf"
fi
fi
fi
Expand All @@ -258,9 +245,7 @@ switch() {
trap "rm -rf \"${DOCKER_BIN_DIR}\"" ERR
mkdir -p "${DOCKER_BIN_DIR}"
wget -qO- "${base_url}/docker-${version}.tgz" | \
tar zxf - -C "${DOCKER_BIN_DIR}" 2>/dev/null || \
wget -qO- "${base_url}/docker-${version}-armhf.tgz" | \
tar zxf - -C "${DOCKER_BIN_DIR}" 2>/dev/null
tar zxf - -C "${DOCKER_BIN_DIR}" 2>/dev/null
if [ -d "${DOCKER_BIN_DIR}/usr/local/bin" ]; then
mv -f "${DOCKER_BIN_DIR}/usr/local/bin"/* "${DOCKER_BIN_DIR}"
rm -rf "${DOCKER_BIN_DIR}/usr"
Expand Down

0 comments on commit e33e25f

Please sign in to comment.