Fix installing rust on Alpine 3.10- (#1045)

* Fix detecting if rust is already installed

* Improve stability of rust uninstallation

* Fix installing rust on Alpine 3.10-

* Test installing datadog_trace

Test: ddtrace
master 2.7.13
Michele Locati 2025-01-13 10:36:02 +01:00 committed by GitHub
parent 3529772073
commit 5a87b11620
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 30 additions and 10 deletions

View File

@ -2617,6 +2617,8 @@ installCargo() {
if command -v cargo >/dev/null; then
return
fi
installCargo_cargoversion=
if ! test -f "$HOME/.cargo/env"; then
printf '# Installing cargo\n'
case "$DISTRO" in
alpine)
@ -2625,7 +2627,21 @@ installCargo() {
;;
esac
curl https://sh.rustup.rs -sSf | sh -s -- -y -q
case "$DISTRO" in
alpine)
if test $DISTRO_MAJMIN_VERSION -le 310; then
# With version 1.84.0 we have this error:
# Error relocating /root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/bin/cargo: posix_spawn_file_actions_addchdir_np: symbol not found
# See https://github.com/rust-lang/rust/pull/131851#issue-2595663507
installCargo_cargoversion=1.83.0
fi
;;
esac
fi
. "$HOME/.cargo/env"
if test -n "$installCargo_cargoversion"; then
rustup default -- "$installCargo_cargoversion"
fi
if test -z "${IPE_UNINSTALL_CARGO:-}"; then
IPE_UNINSTALL_CARGO=y
fi
@ -4961,9 +4977,13 @@ fixLetsEncrypt() {
# Cleanup everything at the end of the execution
cleanup() {
if test "${IPE_UNINSTALL_CARGO:-}" = y; then
if test -f "$HOME/.cargo/env"; then
. "$HOME/.cargo/env"
fi
if command -v rustup >/dev/null; then
rustup self uninstall -y
fi
fi
if test -n "$UNNEEDED_PACKAGE_LINKS"; then
printf '### REMOVING UNNEEDED PACKAGE LINKS ###\n'
for cleanup_link in $UNNEEDED_PACKAGE_LINKS; do