[Ubuntu] Implement helper to get GitHub package download URL (#4947)

This commit is contained in:
Dibir Magomedsaygitov
2022-02-08 19:41:23 +03:00
committed by GitHub
parent cb8931646f
commit 404da76e17
14 changed files with 47 additions and 34 deletions

View File

@@ -4,15 +4,16 @@
## Desc: Installs CMake
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/install.sh
# Test to see if the software in question is already installed, if not install it
echo "Checking to see if the installer script has already been run"
if command -v cmake; then
echo "cmake is already installed"
else
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 | grep -v "rc" | tail -1)
sh_url=$(echo $json | jq -r ".[] | select(.tag_name==\"${latest_tag}\").assets[].browser_download_url | select(endswith(\"inux-x86_64.sh\"))")
curl -sL ${sh_url} -o cmakeinstall.sh \
downloadUrl=$(get_github_package_download_url "Kitware/CMake" "endswith(\"inux-x86_64.sh\")")
curl -sL ${downloadUrl} -o cmakeinstall.sh \
&& chmod +x cmakeinstall.sh \
&& ./cmakeinstall.sh --prefix=/usr/local --exclude-subdir \
&& rm cmakeinstall.sh