Open sjparkinson opened 5 years ago
This is work in progress, but I've also run the script through shellcheck and made a few improvements such as checking if the repository returns a 404 before downloading the releases.
https://gist.github.com/sjparkinson/327dc78c60ab81a06c946630b4288910
I'll make a PR to include these changes too.
A project I maintain recently ran into the issue the current trust download script fails on systems where rustc
reports a linux-gnu
target, because we only provide a prebuilt linux-musl
target for portability reasons.
Please feel free to consider this not in-scope for this issue, but it would be nice if a linux system would try to download both the -gnu
target and the -musl
target. Ideally, it would try the -musl
target first, because that's more likely to work on all linux versions of all linux distros, even ones that have a very old system libc.
I wrote a near drop-in replacement install script that will check for -musl
, -gnu
suffixes and also even doesn't require rustc
to be present on the system to detect the platform (uses platform detection code take from rustup).
https://github.com/rossmacarthur/install
curl -LSfs https://rossmacarthur.github.io/install/crate.sh \
| bash -s -- --repo "japaric/cross" --to ~/.cargo/bin
If
--target
isn't supplied there is a dependency onrustc
to find the target triple.https://github.com/japaric/trust/blob/08c86c03efb887c33abd4bd5bc3677f81bac98e7/install.sh#L99-L102
https://github.com/japaric/trust/blob/08c86c03efb887c33abd4bd5bc3677f81bac98e7/install.sh#L127
Given the usage instructions at https://github.com/japaric/trust#use-the-binary-releases-on-travis-ci, it surprised me that the script uses
rustc
to find the target triple.If we could determine
target
by using commands likeuname -a
this script would be significantly more portable.I'll try and dig up what could work across macOS and Linux.