add idempotent rust install check for safe installation in container

This commit is contained in:
usrbinkat 2025-01-30 05:36:27 +00:00
parent e055688dac
commit dceddd16f8

View File

@ -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