|
4 | 4 |
|
5 | 5 | set -eu
|
6 | 6 |
|
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 |
9 | 8 | LINK_NAME="${LINK_NAME:-com.docker.cli}"
|
10 | 9 | DRY_RUN="${DRY_RUN:-}"
|
11 | 10 |
|
@@ -81,9 +80,26 @@ if ! [ "$(command -v docker)" ]; then
|
81 | 80 | exit 1
|
82 | 81 | fi
|
83 | 82 |
|
| 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 | + |
84 | 93 | # Check if the ACI CLI is already installed
|
85 | 94 | 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." |
87 | 103 | exit 1
|
88 | 104 | fi
|
89 | 105 |
|
@@ -130,14 +146,6 @@ elif ! [ $usr_local_bin_pos -lt $usr_bin_pos ]; then
|
130 | 146 | exit 1
|
131 | 147 | fi
|
132 | 148 |
|
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 |
| - |
141 | 149 | echo "Checks passed!"
|
142 | 150 | echo "Downloading CLI..."
|
143 | 151 |
|
|
0 commit comments