Files
runner-images/images/linux/scripts/installers/cmake.sh
Ewout ter Hoeven a7287233bc [Ubuntu] Always install latest CMake version (#2131)
* [Ubuntu] Always install latest CMake version

Should fix #2129 and succeeds #2126 

Thanks to @unfor19 for [this solution](https://gist.github.com/steinwaywhw/a4cd19cda655b8249d908261a62687f8#gistcomment-3459923)

Please test extensively.

* [Ubuntu] CMake.sh: Use jq instead of grep

* [Ubuntu] cmake.sh: Extract URL directly from API output

Co-authored by @al-cheb, thanks!
2020-12-02 12:57:05 +03:00

25 lines
984 B
Bash

#!/bin/bash -e
################################################################################
## File: cmake.sh
## Desc: Installs CMake
################################################################################
# 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
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 \
&& chmod +x cmakeinstall.sh \
&& ./cmakeinstall.sh --prefix=/usr/local --exclude-subdir \
&& rm cmakeinstall.sh
fi
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v cmake; then
echo "cmake was not installed"
exit 1
fi