rootless: support channels (stable/nightly)

The default channel is set to "stable".

The latest stable version is currently hardcoded in the script.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda committed 2019-10-24 17:02:39 +09:00
1 parent f45d7c1138
commit ad81e227de
1 file changed
+27 -7
+27 -7
View File
@@ -1,5 +1,5 @@
#!/bin/sh
set -e
# This script is meant for quick & easy install via:
# $ curl -fsSL https://get.docker.com/rootless -o get-docker.sh
# $ sh get-docker.sh
@@ -15,7 +15,32 @@ SCRIPT_COMMIT_SHA=UNKNOWN
# This script should be run with an unprivileged user and install/setup Docker under $HOME/bin/.
set -e
# The channel to install from:
# * nightly
# * stable
DEFAULT_CHANNEL_VALUE="stable"
if [ -z "$CHANNEL" ]; then
CHANNEL=$DEFAULT_CHANNEL_VALUE
fi
# The latest release is currently hard-coded.
STABLE_LATEST="19.03.4"
STATIC_RELEASE_URL=
STATIC_RELEASE_ROOTLESS_URL=
case "$CHANNEL" in
"stable")
echo "# Installing stable version ${STABLE_LATEST}"
STATIC_RELEASE_URL="https://download.docker.com/linux/static/$CHANNEL/$(uname -m)/docker-${STABLE_LATEST}.tgz"
STATIC_RELEASE_ROOTLESS_URL="https://download.docker.com/linux/static/$CHANNEL/$(uname -m)/docker-rootless-extras-${STABLE_LATEST}.tgz"
;;
"nightly")
echo "# Installing nightly"
STATIC_RELEASE_URL="https://master.dockerproject.org/linux/$(uname -m)/docker.tgz"
STATIC_RELEASE_ROOTLESS_URL="https://master.dockerproject.org/linux/$(uname -m)/docker-rootless-extras.tgz"
;;
*)
>&2 echo "Aborting because of unknown CHANNEL \"$CHANNEL\". Set \$CHANNEL to either \"stable\" or \"nightly\"."; exit 1
;;
esac
init_vars() {
BIN="${DOCKER_BIN:-$HOME/bin}"
@@ -305,11 +330,6 @@ do_install() {
tmp=$(mktemp -d)
trap "rm -rf $tmp" EXIT INT TERM
# Alternatively could find latest nightly release from https://download.docker.com/linux/static/nightly/ .
# Later we can provide different channels.
STATIC_RELEASE_URL="https://master.dockerproject.org/linux/x86_64/docker.tgz"
STATIC_RELEASE_ROOTLESS_URL="https://master.dockerproject.org/linux/x86_64/docker-rootless-extras.tgz"
# Download tarballs docker-* and docker-rootless-extras=*
(
cd "$tmp"