fix: handle rust toolchain

This commit is contained in:
Price Hiller 2022-07-30 22:56:10 -05:00
parent 3f8530dfb8
commit 9eec3451c6

View File

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