Skip to content

Commit d0cfde8

Browse files
authored
3.2.0
Update the script used for installing Cargo.
1 parent 7248a6e commit d0cfde8

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

install-ffmpeg-5_0.sh

+14-6
Original file line numberDiff line numberDiff 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

5660
SET_HELP=false
5761
SET_DEBUG=false
@@ -393,12 +397,16 @@ fi
393397

394398
# Install rustc and meson.
395399
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
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

0 commit comments

Comments
 (0)