From 0a9854e304971eb3e584a5e3b39c7dfb899a68e7 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sat, 30 Jul 2022 22:36:41 -0500 Subject: [PATCH] feat: handle missing toolchains --- install.bash | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/install.bash b/install.bash index 9acef56..6ecf0e6 100644 --- a/install.bash +++ b/install.bash @@ -102,7 +102,13 @@ install-rust() { fi export PATH="${PATH}:${install_path}/cargo/bin" - rustup default stable + if [[ -z "$(ls "${RUSTUP_HOME}/toolchains")" ]]; then + log "info" "No toolchain found, installing a ${GREEN}Rust${RESET_BOLD} toolchain" + log "info" "Setting ${GREEN}Rust{$RESET_BOLD}'s toolchain to ${GREEN}stable${RESET_BOLD}" + rustup default stable + else + log "info" "${GREEN}Rust${RESET_BOLD} toolchain found, skipping toolchain setup" + fi } install-cargo-binary() {