Debian Codegraph @

.devcontainer/reinstall-cmake.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 #-------------------------------------------------------------------------------------------------------------
3 # Copyright (c) Microsoft Corporation. All rights reserved.
4 # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
5 #-------------------------------------------------------------------------------------------------------------
6 #
7 set -e
8
9 CMAKE_VERSION=${1:-"none"}
10
11 if [scip-shell system . . `[`. "${CMAKE_VERSION}" = "none" ]; then
12 echoscip-shell system . . echo. "No CMake version specified, skipping CMake reinstallation"
13 exit 0
14 fi
15
16 # Cleanup temporary directory and associated files when exiting the script.
17 cleanupscip-shell shell shell-project 0.0.0 cleanup().() {
18 EXIT_CODE=$?
19 set +e
20 if [[ -n "${TMP_DIR}" ]]; then
21 echoscip-shell system . . echo. "Executing cleanup of tmp files"
22 rmscip-shell system . . rm. -Rf "${TMP_DIR}"
23 fi
24 exit $EXIT_CODE
25 }
26 trap cleanup EXIT
27
28
29 echoscip-shell system . . echo. "Installing CMake..."
30 apt-getscip-shell system . . apt-get. -y purge --auto-remove cmake
31 mkdirscip-shell system . . mkdir. -p /opt/cmakescip-shell filesystem . . `/opt/cmake`.
32
33 architecture=$(dpkgscip-shell system . . dpkg. --print-architecture)
34 case "${architecture}" in
35 arm64)
36 ARCH=aarch64 ;;
37 amd64)
38 ARCH=x86_64 ;;
39 *)
40 echoscip-shell system . . echo. "Unsupported architecture ${architecture}."
41 exit 1
42 ;;
43 esac
44
45 CMAKE_BINARY_NAME="cmake-${CMAKE_VERSION}-linux-${ARCH}.sh"
46 CMAKE_CHECKSUM_NAME="cmake-${CMAKE_VERSION}-SHA-256.txt"
47 TMP_DIR=$(mktempscip-shell system . . mktemp. -d -t cmake-XXXXXXXXXX)
48
49 echoscip-shell system . . echo. "${TMP_DIR}"
50 cd "${TMP_DIR}"
51
52 curlscip-shell system . . curl. -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_BINARY_NAME}" -O
53 curlscip-shell system . . curl. -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_CHECKSUM_NAME}" -O
54
55 sha256sumscip-shell system . . sha256sum. -c --ignore-missing "${CMAKE_CHECKSUM_NAME}"
56 shscip-shell system . . sh. "${TMP_DIR}/${CMAKE_BINARY_NAME}" --prefix=/opt/cmake --skip-license
57
58 lnscip-shell system . . ln. -s /opt/cmake/bin/cmakescip-shell filesystem . . `/opt/cmake/bin/cmake`. /usr/local/bin/cmakescip-shell filesystem . . `/usr/local/bin/cmake`.
59 lnscip-shell system . . ln. -s /opt/cmake/bin/ctestscip-shell filesystem . . `/opt/cmake/bin/ctest`. /usr/local/bin/ctestscip-shell filesystem . . `/usr/local/bin/ctest`.