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

Commit f530f5a

Browse files
committed
Updated script to get latest release (not a pinned version)
1 parent fa8d3b1 commit f530f5a

File tree

3 files changed

+43
-17
lines changed

3 files changed

+43
-17
lines changed

README.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,12 @@ with a fresh install of Ubuntu 20.04.
5252
You can install the new CLI using the install script:
5353

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

5858
### Manual install
5959

60-
You can download the Docker ACI Integration CLI using the following command:
61-
62-
```console
63-
curl -Lo docker-aci https://github.com/docker/aci-integration-beta/releases/download/v0.1.4/docker-linux-amd64
64-
```
60+
You can download the Docker ACI Integration CLI from [latest release](https://github.com/docker/aci-integration-beta/releases/latest).
6561

6662
You will then need to make it executable:
6763

@@ -132,3 +128,11 @@ be done as follows:
132128
```console
133129
sudo rm /usr/local/bin/docker /usr/local/bin/com.docker.cli
134130
```
131+
132+
## Testing the install script
133+
134+
To test the install script, from a machine with docker:
135+
136+
```console
137+
docker build -t testclilinux -f scripts/Dockerfile-testInstall scripts
138+
```

scripts/Dockerfile-testInstall

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM ubuntu:latest
2+
3+
RUN apt-get update
4+
RUN apt-get -y install curl grep
5+
RUN curl https://get.docker.com | sh
6+
7+
COPY install_linux.sh /scripts/install_linux.sh
8+
RUN chmod +x /scripts/install_linux.sh
9+
RUN /scripts/install_linux.sh
10+
RUN docker version | grep Azure
11+
12+
# check we can update
13+
RUN /scripts/install_linux.sh
14+
RUN docker version | grep Azure

scripts/install_linux.sh

+19-11
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
set -eu
66

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

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

83+
download_cmd='curl -fsSLo'
84+
# Check that system has curl installed
85+
if ! [ "$(command -v curl)" ]; then
86+
echo "Error: curl not found"
87+
echo "Please install curl"
88+
exit 1
89+
fi
90+
91+
DOWNLOAD_URL=$(curl -s ${RELEASE_URL} | grep "browser_download_url.*docker-linux-amd64" | cut -d : -f 2,3)
92+
8493
# Check if the ACI CLI is already installed
8594
if [ $(is_new_cli "docker") -eq 1 ]; then
86-
echo "You already have the Docker ACI Integration CLI installed"
95+
if [ $(is_new_cli "/usr/local/bin/docker") -eq 1 ]; then
96+
echo "You already have the Docker ACI Integration CLI installed, overriding with latest version"
97+
download_dir=$($sh_c 'mktemp -d')
98+
$sh_c "${download_cmd} ${download_dir}/docker-aci ${DOWNLOAD_URL}"
99+
$sudo_sh_c "install -m 775 ${download_dir}/docker-aci /usr/local/bin/docker"
100+
exit 0
101+
fi
102+
echo "You already have the Docker ACI Integration CLI installed, in a different location."
87103
exit 1
88104
fi
89105

@@ -130,14 +146,6 @@ elif ! [ $usr_local_bin_pos -lt $usr_bin_pos ]; then
130146
exit 1
131147
fi
132148

133-
download_cmd='curl -fsSLo'
134-
# Check that system has curl installed
135-
if ! [ "$(command -v curl)" ]; then
136-
echo "Error: curl not found"
137-
echo "Please install curl"
138-
exit 1
139-
fi
140-
141149
echo "Checks passed!"
142150
echo "Downloading CLI..."
143151

0 commit comments

Comments
 (0)