No longer rely on cargo-update
This commit is contained in:
parent
6c9f0b1d0a
commit
61558ca515
36
bin/update
36
bin/update
@ -244,21 +244,31 @@ update-rust() {
|
||||
echo -e "\033[32;1m=== Updating rust ===\033[0m"
|
||||
rustup update
|
||||
|
||||
cargo install-update --help > /dev/null 2>&1
|
||||
|
||||
# Program to update cargo programs is not installed
|
||||
if [ $? -ne 0 ]; then
|
||||
|
||||
echo -e "\033[33;1m=== To allow updating rust packages, run \`cargo install cargo-update\`===\033[0m"
|
||||
|
||||
fi
|
||||
|
||||
# If the user has no root, and if he doesn't have openssl, we won't install cargo update.
|
||||
# Before running cargo update, we check again that it is installed.
|
||||
cargo install-update --help > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "\033[32;1m=== Updating rust packages ===\033[0m"
|
||||
cargo install-update -ag
|
||||
|
||||
IFS=$'\n'
|
||||
for line in $(cargo install --list); do
|
||||
if [[ $line == " "* ]] || [[ $line == "\t"* ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ $line == *"("* ]]; then
|
||||
crate=$(echo $line | cut -d ' ' -f 1)
|
||||
full_repo=$(echo $line | cut -d '(' -f 2 | cut -d ')' -f 1)
|
||||
repo=$(echo $full_repo | cut -d '#' -f 1)
|
||||
current_commit=$(echo $full_repo | cut -d '#' -f 2)
|
||||
latest_commit=$(git ls-remote $repo | head -n 1 | cut -d $'\t' -f 1)
|
||||
|
||||
if [[ $latest_commit == ${current_commit}* ]]; then
|
||||
echo -e " \x1b[32;1mIgnored\x1b[0m package \`$crate\` is already installed"
|
||||
else
|
||||
cargo install --git $repo
|
||||
fi
|
||||
else
|
||||
cargo install $(echo $line | cut -d ' ' -f 1)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
local seconds=$((`date +%s` - $start))
|
||||
|
Loading…
x
Reference in New Issue
Block a user