From dceddd16f8a76060bdce7b57e7234802bda17dec Mon Sep 17 00:00:00 2001 From: usrbinkat Date: Thu, 30 Jan 2025 05:36:27 +0000 Subject: [PATCH] add idempotent rust install check for safe installation in container --- dev-setup/install_linux_prerequisites.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dev-setup/install_linux_prerequisites.sh b/dev-setup/install_linux_prerequisites.sh index 994a9fde..835f3606 100755 --- a/dev-setup/install_linux_prerequisites.sh +++ b/dev-setup/install_linux_prerequisites.sh @@ -1,5 +1,6 @@ #!/bin/bash -set -eo pipefail +#set -eo pipefail +set -ex if [ $(id -u) -eq 0 ]; then echo "Don't run this as root" @@ -27,9 +28,14 @@ elif [ ! -z "$(command -v dnf)" ]; then sudo dnf groupinstall -y 'Development Tools' fi -# Install Rust -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -c clippy --profile default -source "$HOME/.cargo/env" +# Install Rust if not already installed +if ! command -v rustc >/dev/null 2>&1; then + echo "Installing Rust..." + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -c clippy --profile default + source "$HOME/.cargo/env" +else + echo "Rust is already installed" +fi #ask if they want to install optional android sdk (and install if yes) while true; do