#!/usr/bin/env bash ###################################################################### # # add_rust_lang.sh - Install Rust toolchain for the project. # # Copyright 2020-2021 Naman Bishnoi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ###################################################################### set -euxo echo "**********************************************************************" echo "Installing Rustup v%%RUSTUP_VERSION%%" echo "**********************************************************************" %%ARCH-MATCH%% # Download the Rustup installer script url="https://static.rust-lang.org/rustup/archive/%%RUSTUP-VERSION%%/${rustArch}/rustup-init" curl -O "$url" # Verify Rustup checksum for integrity echo "${rustupSha256} *rustup-init" | sha256sum -c - # Make Rustup executable chmod +x rustup-init echo "**********************************************************************" echo "Installing Rust v%%RUST-VERSION%%" echo "**********************************************************************" RUSTUP_HOME=%%RUSTUP-HOME%% \ CARGO_HOME=%%CARGO-HOME%% \ PATH=%%PATH%% \ ./rustup-init -y --no-modify-path --profile minimal --default-toolchain %%RUST-VERSION%% --default-host ${rustArch} rm rustup-init # Grants permission for particular directories chmod -R a+w %%RUSTUP-HOME%% %%CARGO-HOME%% echo "**********************************************************************" echo "Installation Completed" echo "**********************************************************************" rustup --version cargo --version rustc --version