From 9eec3451c632ece7dc2dd331efdad979d259ae1f Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sat, 30 Jul 2022 22:56:10 -0500 Subject: [PATCH] fix: handle rust toolchain --- install.bash | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/install.bash b/install.bash index 2d1d870..9800014 100644 --- a/install.bash +++ b/install.bash @@ -96,21 +96,22 @@ install-rust() { export RUSTUP_HOME="${install_path}/rustup" if ! [[ -e "${CARGO_HOME}" ]] || ! [[ -e "${RUSTUP_HOME}" ]]; then - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | ${RUSTUP_HOME} sh -s -- -y --quiet + 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}" + ( + printf "%s" "${install_path}/cargo/bin/rustup default stable" | zsh + ) + else + log "info" "${GREEN}Rust${RESET_BOLD} toolchain found, skipping toolchain setup" + fi else log "info" "${GREEN}Rust${RESET_BOLD} already installed, skipping" fi export PATH="${PATH}:${install_path}/cargo/bin" - 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}" - ( - printf "%s" "rustup default stable" | zsh - ) - else - log "info" "${GREEN}Rust${RESET_BOLD} toolchain found, skipping toolchain setup" - fi } install-cargo-binary() { @@ -179,7 +180,7 @@ deploy-config() { main() { local tasks_done=() PKG_INSTALL_CMD="${*}" - if [[ -z "${PKG_INSTALL_CMD}" ]]; then + if [[ -z "${PKG_INSTALL_CMD}" ]] && ! [[ "${SKIP_PKG_INSTALL}" = true ]]; then log "error" "A package installer must be passed to install missing packages, or ${GREEN}SKIP_PKG_INSTALL=TRUE${RESET_BOLD} must be set." return 1 fi