forked from eclipse-uprotocol/up-transport-iceoryx2-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-rust-toolchain.sh
More file actions
executable file
·29 lines (28 loc) · 1.2 KB
/
install-rust-toolchain.sh
File metadata and controls
executable file
·29 lines (28 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
################################################################################
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https: //www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
################################################################################
install_rust_toolchain() {
source ${WORKSPACE_FOLDER}/.devcontainer/scripts/functions/get-arch-and-os.sh
read -r TARGET_ARCH TARGET_OS <<< "$(get_arch_and_os)"
ARCH_AND_OS="${TARGET_ARCH}-${TARGET_OS}"
echo "Detected architecture and OS: $ARCH_AND_OS"
RUST_TOOLCHAIN="stable-$ARCH_AND_OS"
if rustup toolchain list | grep -q $RUST_TOOLCHAIN; then
echo "Rust toolchain '$RUST_TOOLCHAIN' is already installed."
return 0
fi
echo "Adding rustup target '$ARCH_AND_OS'"
rustup target add "$ARCH_AND_OS"
echo "Installing Rust toolchain for '$ARCH_AND_OS'"
rustup toolchain install "$RUST_TOOLCHAIN"
}