Dont force install cargo install-update

This commit is contained in:
Thomas Forgione 2019-11-03 15:59:08 +01:00
parent 4f36945dd7
commit 6f0eeea38f
No known key found for this signature in database
GPG Key ID: BFD17A2D71B3B5E7
1 changed files with 1 additions and 38 deletions

View File

@ -198,45 +198,8 @@ update-rust() {
# Program to update cargo programs is not installed # Program to update cargo programs is not installed
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
# This program requires openssl, so check that it is installed echo -e "\033[33;1m=== To allow updating rust packages, run \`cargo install install-update\`===\033[0m"
pkg-config --libs --cflags openssl > /dev/null 2>&1
local installed_openssl=$?
# We need to install openssl
if [ $installed_openssl -ne 0 ]; then
# If the user has root power
if [ ! -f ~/.config/dotfiles/.data/noroot ]; then
echo -e "\033[32;1m=== libssl-dev is needed to update rust packages ===\033[0m"
sudo true
if [ $? -eq 0 ]; then
# For ubuntu
command -v apt > /dev/null 2>&1
if [ $? -eq 0 ]; then
sudo apt install -y libssl-dev
installed_openssl=0
fi
# For fedora
command -v dnf > /dev/null 2>&1
if [ $? -eq 0 ]; then
sudo dnf install openssl-devel
installed_openssl=0
fi
fi
fi
fi
# Only try to install if openssl is installed
if [ $installed_openssl -eq 0 ]; then
echo -e "\033[32;1m=== Installing rust packages updater ===\033[0m"
cargo install cargo-update
fi
fi fi
# If the user has no root, and if he doesn't have openssl, we won't install cargo update. # If the user has no root, and if he doesn't have openssl, we won't install cargo update.