From c87b27a593510007d24d976461ed3d777485cbaa Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com> Date: Mon, 15 Feb 2021 19:18:13 +0300 Subject: [PATCH] install latest version of cmake (#2714) --- images/linux/scripts/installers/cmake.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/images/linux/scripts/installers/cmake.sh b/images/linux/scripts/installers/cmake.sh index 7be3b52a0..3ad0f4784 100644 --- a/images/linux/scripts/installers/cmake.sh +++ b/images/linux/scripts/installers/cmake.sh @@ -9,8 +9,10 @@ echo "Checking to see if the installer script has already been run" if command -v cmake; then echo "cmake is already installed" else - url=$(curl -s https://api.github.com/repos/Kitware/CMake/releases/latest | jq -r '.assets[].browser_download_url | select(contains("Linux-x86_64.sh"))') - curl -sL ${url} -o cmakeinstall.sh \ + json=$(curl -s "https://api.github.com/repos/Kitware/CMake/releases") + latest_tag=$(echo $json | jq -r '.[] | select(.prerelease==false).tag_name' | sort --unique --version-sort | tail -1) + sh_url=$(echo $json | jq -r ".[] | select(.tag_name==\"${latest_tag}\").assets[].browser_download_url | select(endswith(\"Linux-x86_64.sh\"))") + curl -sL ${sh_url} -o cmakeinstall.sh \ && chmod +x cmakeinstall.sh \ && ./cmakeinstall.sh --prefix=/usr/local --exclude-subdir \ && rm cmakeinstall.sh