From 62335ebdf8926f2201cfa9dc55ba80b418e6e1b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Forlini?= Date: Tue, 13 Sep 2022 21:30:15 +0200 Subject: [PATCH] fix: avoid calling defaults on newly installed toolchain --- step.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/step.sh b/step.sh index 38326a7..b752df4 100755 --- a/step.sh +++ b/step.sh @@ -29,12 +29,14 @@ fi # Export PATH via envman to make the toolchain available for the next steps. envman add --key "PATH" --value "${PATH}:${HOME}/.cargo/bin" -# Calling set_default_rustup() to ensure the required version of rustc is used, as ~/.rustup/settings.toml might have been restored from cache. -set_default_rustup - -# Update is not performed on first install as the download has just happened. Auto update is also applied only on stable or nightly versions. -if [[ "${RUST_AUTO_UPDATE_TOOLCHAIN}" = true && "${IS_FIRST_INSTALL}" = false && ("${RUST_VERSION}" = "stable" || "${RUST_VERSION}" = "nightly") ]]; then - update_rustup +if [ "${IS_FIRST_INSTALL}" = false ]; then + # Calling set_default_rustup() to ensure the required version of rustc is used, as ~/.rustup/settings.toml might have been restored from cache. + set_default_rustup + + # Auto update is applied only on stable or nightly versions. + if [[ "${RUST_AUTO_UPDATE_TOOLCHAIN}" = true && ("${RUST_VERSION}" = "stable" || "${RUST_VERSION}" = "nightly") ]]; then + update_rustup + fi fi # Use envman to add versions as ENV.