File tree 1 file changed +14
-6
lines changed
1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,10 @@ function apt_dependency {
52
52
apt-get -y install $( apt-cache depends $1 | grep Depends | sed " s/.*ends:\ //" | tr ' \n' ' ' ) || fail
53
53
}
54
54
55
+ function nvm_has {
56
+ type " $1 " > /dev/null 2>&1
57
+ }
58
+
55
59
56
60
SET_HELP=false
57
61
SET_DEBUG=false
393
397
394
398
# Install rustc and meson.
395
399
if [ " 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
402
410
msg " ${COLOR_OPT} --rustc): ${COLOR_OPT_TEXT} Install the newest meson."
403
411
sudo pip3 install --user meson || fail
404
412
sudo cp ~ /.local/bin/meson /usr/local/bin/ || fail
You can’t perform that action at this time.
0 commit comments