File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,10 @@ function apt_dependency {
5252 apt-get -y install $( apt-cache depends $1 | grep Depends | sed " s/.*ends:\ //" | tr ' \n' ' ' ) || fail
5353}
5454
55+ function nvm_has {
56+ type " $1 " > /dev/null 2>&1
57+ }
58+
5559
5660SET_HELP=false
5761SET_DEBUG=false
393397
394398# Install rustc and meson.
395399if [ " x${SET_RUSTC} " = " xtrue" ]; then
396- msg " ${COLOR_OPT} --rustc): ${COLOR_OPT_TEXT} Install Rust-lang, Cargo 1.59.0."
397- curl --proto ' =https' --tlsv1.2 -sSf https://sh.rustup.rs | sh || fail
398- source $HOME /.cargo/env || fail
399- rustup toolchain install 1.59.0 || fail
400- cargo install cargo-c || fail
401-
400+ if nvm_has " cargo" ; then
401+ msg " ${COLOR_OPT} --rustc): ${COLOR_OPT_TEXT} Skip the installation of Rust-lang and Cargo, because cargo is detected."
402+ else
403+ msg " ${COLOR_OPT} --rustc): ${COLOR_OPT_TEXT} Install Rust-lang, Cargo 1.60.0."
404+ curl --proto ' =https' --tlsv1.2 -sSf https://sh.rustup.rs | sh || fail
405+ source $HOME /.cargo/env || fail
406+ rustup toolchain install 1.60.0 || fail
407+ rustup default 1.60.0 || fail
408+ cargo install cargo-c || fail
409+ fi
402410 msg " ${COLOR_OPT} --rustc): ${COLOR_OPT_TEXT} Install the newest meson."
403411 sudo pip3 install --user meson || fail
404412 sudo cp ~ /.local/bin/meson /usr/local/bin/ || fail
You can’t perform that action at this time.
0 commit comments