fix: do toolchain check after rust install

This commit is contained in:
Price Hiller 2022-07-30 23:16:37 -05:00
parent da4d362141
commit 33c2859bfc

View File

@ -97,19 +97,19 @@ install-rust() {
if ! [[ -e "${CARGO_HOME}" ]] || ! [[ -e "${RUSTUP_HOME}" ]]; then
log "info" "Rust installs set to ${GREEN}cargo${RESET_BOLD}: ${GREEN}${CARGO_HOME}${RESET_BOLD} & ${GREEN}rustup${RESET_BOLD}: ${GREEN}${RUSTUP_HOME}${RESET_BOLD}"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --quiet
if [[ -z "$(ls "${RUSTUP_HOME}/toolchains" >/dev/null)" ]]; 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}"
if ! "${CARGO_HOME}/bin/rustup" default stable; then
log "error" "Failed to set a ${GREEN}Rust${RESET_BOLD} toolchain"
return 1
fi
else
log "info" "${GREEN}Rust${RESET_BOLD} toolchain found, skipping toolchain setup"
fi
else
log "info" "${GREEN}Rust${RESET_BOLD} already installed, skipping"
fi
if [[ -z "$(ls "${RUSTUP_HOME}/toolchains" >/dev/null)" ]]; 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}"
if ! "${CARGO_HOME}/bin/rustup" default stable; then
log "error" "Failed to set a ${GREEN}Rust${RESET_BOLD} toolchain"
return 1
fi
else
log "info" "${GREEN}Rust${RESET_BOLD} toolchain found, skipping toolchain setup"
fi
export PATH="${PATH}:${install_path}/cargo/bin"
}