diff --git a/rootless-install.sh b/rootless-install.sh index 7ac5ed7..b40565f 100755 --- a/rootless-install.sh +++ b/rootless-install.sh @@ -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"