History

Improve install-cmake script (#20836)

- Don't output junk to stderr when cmake unavailable - Kitware PPA does not include up to date bins for all distros (e.g. Ubuntu 24 only has 3.30.2 although 3.30.4 has been out for a while) so don't try to force install a specific version. Take the best we can get.

Peter Tripp committed 1 year ago

Commit 5b317f61 parent e2552b91 file · +2 −2Browse files

Showing the changes to script (1 of 1 file). Show all

Unified · Split

script/install-cmake+2−2
@@ -35,7 +35,7 @@ CMAKE_VERSION="${CMAKE_VERSION:-${1:-3.30.4}}" · 34 unmodified lines
35 35
36if [ "$(whoami)" = root ]; then SUDO=; else SUDO="$(command -v sudo || command -v doas || true)"; fi36if [ "$(whoami)" = root ]; then SUDO=; else SUDO="$(command -v sudo || command -v doas || true)"; fi
37 37
38if cmake --version | grep -q "$CMAKE_VERSION"; then38if cmake --version 2>/dev/null | grep -q "$CMAKE_VERSION"; then
39 echo "CMake $CMAKE_VERSION is already installed."39 echo "CMake $CMAKE_VERSION is already installed."
40 exit 040 exit 0
41elif [ -e /usr/local/bin/cmake ]; then41elif [ -e /usr/local/bin/cmake ]; then
@@ -51,7 +51,7 @@ elif [ -e /etc/lsb-release ] && grep -qP 'DISTRIB_ID=Ubuntu' /etc/lsb-release; t · 9 unmodified lines
51 echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" \51 echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" \
52 | $SUDO tee /etc/apt/sources.list.d/kitware.list >/dev/null52 | $SUDO tee /etc/apt/sources.list.d/kitware.list >/dev/null
53 $SUDO apt-get update53 $SUDO apt-get update
54 $SUDO apt-get install -y kitware-archive-keyring cmake==$CMAKE_VERSION54 $SUDO apt-get install -y kitware-archive-keyring cmake
55else55else
56 arch="$(uname -m)"56 arch="$(uname -m)"
57 if [ "$arch" != "x86_64" ] && [ "$arch" != "aarch64" ]; then57 if [ "$arch" != "x86_64" ] && [ "$arch" != "aarch64" ]; then

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t