Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.

Commit

Permalink
Updated script to get latest release (not a pinned version)
Browse files Browse the repository at this point in the history
  • Loading branch information
gtardif committed Jul 9, 2020
1 parent fa8d3b1 commit f530f5a
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 17 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,12 @@ with a fresh install of Ubuntu 20.04.
You can install the new CLI using the install script:

```console
curl -L https://github.com/docker/aci-integration-beta/releases/download/v0.1.4/install.sh | sh
curl -L https://github.com/docker/aci-integration-beta/blob/main/scripts/install_linux.sh | sh
```

### Manual install

You can download the Docker ACI Integration CLI using the following command:

```console
curl -Lo docker-aci https://github.com/docker/aci-integration-beta/releases/download/v0.1.4/docker-linux-amd64
```
You can download the Docker ACI Integration CLI from [latest release](https://github.com/docker/aci-integration-beta/releases/latest).

You will then need to make it executable:

Expand Down Expand Up @@ -132,3 +128,11 @@ be done as follows:
```console
sudo rm /usr/local/bin/docker /usr/local/bin/com.docker.cli
```

## Testing the install script

To test the install script, from a machine with docker:

```console
docker build -t testclilinux -f scripts/Dockerfile-testInstall scripts
```
14 changes: 14 additions & 0 deletions scripts/Dockerfile-testInstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ubuntu:latest

RUN apt-get update
RUN apt-get -y install curl grep
RUN curl https://get.docker.com | sh

COPY install_linux.sh /scripts/install_linux.sh
RUN chmod +x /scripts/install_linux.sh
RUN /scripts/install_linux.sh
RUN docker version | grep Azure

# check we can update
RUN /scripts/install_linux.sh
RUN docker version | grep Azure
30 changes: 19 additions & 11 deletions scripts/install_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

set -eu

CLI_VERSION=${CLI_VERSION:-0.1.4}
DOWNLOAD_URL="${DOWNLOAD_URL:-https://github.com/docker/aci-integration-beta/releases/download/v${CLI_VERSION}/docker-linux-amd64}"
RELEASE_URL=https://api.github.com/repos/docker/aci-integration-beta/releases/latest
LINK_NAME="${LINK_NAME:-com.docker.cli}"
DRY_RUN="${DRY_RUN:-}"

Expand Down Expand Up @@ -81,9 +80,26 @@ if ! [ "$(command -v docker)" ]; then
exit 1
fi

download_cmd='curl -fsSLo'
# Check that system has curl installed
if ! [ "$(command -v curl)" ]; then
echo "Error: curl not found"
echo "Please install curl"
exit 1
fi

DOWNLOAD_URL=$(curl -s ${RELEASE_URL} | grep "browser_download_url.*docker-linux-amd64" | cut -d : -f 2,3)

# Check if the ACI CLI is already installed
if [ $(is_new_cli "docker") -eq 1 ]; then
echo "You already have the Docker ACI Integration CLI installed"
if [ $(is_new_cli "/usr/local/bin/docker") -eq 1 ]; then
echo "You already have the Docker ACI Integration CLI installed, overriding with latest version"
download_dir=$($sh_c 'mktemp -d')
$sh_c "${download_cmd} ${download_dir}/docker-aci ${DOWNLOAD_URL}"
$sudo_sh_c "install -m 775 ${download_dir}/docker-aci /usr/local/bin/docker"
exit 0
fi
echo "You already have the Docker ACI Integration CLI installed, in a different location."
exit 1
fi

Expand Down Expand Up @@ -130,14 +146,6 @@ elif ! [ $usr_local_bin_pos -lt $usr_bin_pos ]; then
exit 1
fi

download_cmd='curl -fsSLo'
# Check that system has curl installed
if ! [ "$(command -v curl)" ]; then
echo "Error: curl not found"
echo "Please install curl"
exit 1
fi

echo "Checks passed!"
echo "Downloading CLI..."

Expand Down

0 comments on commit f530f5a

Please sign in to comment.