cargo-install-all.sh: on Mac OS X, use greadlink instead of readlink (#16642)

* on Mac OS X, use greadlink when building from source

* this is a cleaner way to do it

* we want to keep the cargo install comment at the top of the script
This commit is contained in:
Christian Drappi 2021-04-19 15:05:46 -04:00 committed by GitHub
parent f5f06904c3
commit 0b84440e0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -3,7 +3,13 @@
# |cargo install| of the top-level crate will not install binaries for
# other workspace crates or native program crates.
here="$(dirname "$0")"
cargo="$(readlink -f "${here}/../cargo")"
readlink_cmd="readlink"
if [[ $OSTYPE == darwin* ]]; then
# Mac OS X's version of `readlink` does not support the -f option,
# But `greadlink` does, which you can get with `brew install coreutils`
readlink_cmd="greadlink"
fi
cargo="$("${readlink_cmd}" -f "${here}/../cargo")"
set -e