Skip to content

Commit 9b4b055

Browse files
fix: use MUSL-based rustup-init for Alpine
Signed-off-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
1 parent 78ee6ed commit 9b4b055

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/rust/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ref: https://github.com/devcontainers/spec/blob/main/schemas/devContainerFeature.schema.json
22
{
33
"id": "rust",
4-
"version": "8.0.3",
4+
"version": "8.0.4",
55
"name": "Development Container Feature - Rust",
66
"documentationURL": "https://github.com/georglauterbach/dev-container-features/tree/main/src/rust",
77
"description": "Work efficiently and effortlessly with the Rust programming language",

src/rust/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -e
55
. /etc/os-release
66

77
if [ "${ID}" = "alpine" ]; then
8-
apk add --no-cache bash coreutils gcompat libgcc
8+
apk add --no-cache bash coreutils gcompat
99
fi
1010

1111
exec /bin/bash "$(dirname "${0}")/install_actual.sh" "${@}"

src/rust/install_actual.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ readonly CURRENT_DIR
1313
# shellcheck source=./common.sh
1414
source "${CURRENT_DIR}/common.sh"
1515

16+
source /etc/os-release
17+
1618
readonly DATA_DIR="${DATA_BASE_DIR}/rust"
1719
mkdir -p "${DATA_DIR}"
1820

@@ -145,7 +147,12 @@ function install_rustup() {
145147
fi
146148

147149
if [[ -z ${RUST_RUSTUP_RUSTUP_INIT_HOST_TRIPLE} ]]; then
148-
RUST_RUSTUP_RUSTUP_INIT_HOST_TRIPLE="$(uname -m)-unknown-linux-gnu"
150+
RUST_RUSTUP_RUSTUP_INIT_HOST_TRIPLE="$(uname -m)-unknown-linux-"
151+
if [[ ${ID} == 'alpine' ]]; then
152+
RUST_RUSTUP_RUSTUP_INIT_HOST_TRIPLE+='musl'
153+
else
154+
RUST_RUSTUP_RUSTUP_INIT_HOST_TRIPLE+='gnu'
155+
fi
149156
log 'debug' "Host triple set to '${RUST_RUSTUP_RUSTUP_INIT_HOST_TRIPLE}'"
150157
fi
151158

@@ -182,7 +189,7 @@ function additional_rust_setup() {
182189
cp "${CURRENT_DIR}/prettifier_for_lldb.py" "${DATA_DIR}/prettifier_for_lldb.py"
183190

184191
if ! command -v rustup &>/dev/null; then
185-
log 'warn' "Command 'rustup' could not be located but is required for the mojority of the additional setup steps"
192+
log 'warn' "Command 'rustup' could not be located but is required for the majority of the additional setup steps"
186193
return 0
187194
fi
188195

0 commit comments

Comments
 (0)