Skip to content

Commit 66331bb

Browse files
authored
[skip changelog] [skip ci] Fix installation script's latest tag determination code (#772)
GitHub changed the HTML of the release page, which resulted in grep finding multiple instances of the pattern, causing the installation script to fail when no version parameter was provided: $ curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh Installing in /home/per/temporary/bin ARCH=64bit OS=Linux Using curl as download tool TAG=0.11.0 0.11.0 0.11.0 CLI_DIST=arduino-cli_0.11.0 0.11.0 0.11.0_Linux_64bit.tar.gz Downloading https://downloads.arduino.cc/arduino-cli/arduino-cli_0.11.0 0.11.0 0.11.0_Linux_64bit.tar.gz Failed to install arduino-cli The chosen fix was to expand the grep pattern to something that should only ever occur once on an HTML page.
1 parent fff99af commit 66331bb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: install.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ checkLatestVersion() {
8484
local regex="[0-9][A-Za-z0-9\.-]*"
8585
local latest_url="https://github.com/arduino/arduino-cli/releases/latest"
8686
if [ "$DOWNLOAD_TOOL" = "curl" ]; then
87-
tag=$(curl -SsL $latest_url | grep -o "Release $regex · arduino/arduino-cli" | grep -o "$regex")
87+
tag=$(curl -SsL $latest_url | grep -o "<title>Release $regex · arduino/arduino-cli" | grep -o "$regex")
8888
elif [ "$DOWNLOAD_TOOL" = "wget" ]; then
89-
tag=$(wget -q -O - $latest_url | grep -o "Release $regex · arduino/arduino-cli" | grep -o "$regex")
89+
tag=$(wget -q -O - $latest_url | grep -o "<title>Release $regex · arduino/arduino-cli" | grep -o "$regex")
9090
fi
9191
if [ "x$tag" = "x" ]; then
9292
echo "Cannot determine latest tag."

0 commit comments

Comments
 (0)