build: enforce JD Cargo source replacement

This commit is contained in:
冰朔 2026-07-17 19:25:40 +08:00
parent 86447ae197
commit cf22f436de

View File

@ -19,6 +19,7 @@ if command -v apt-get >/dev/null 2>&1; then
fi fi
command -v node >/dev/null || { echo "Node.js is required." >&2; exit 2; } command -v node >/dev/null || { echo "Node.js is required." >&2; exit 2; }
export PATH="$HOME/.cargo/bin:$PATH"
if ! command -v cargo >/dev/null 2>&1; then if ! command -v cargo >/dev/null 2>&1; then
command -v curl >/dev/null || { echo "curl is required to install Rust." >&2; exit 2; } command -v curl >/dev/null || { echo "curl is required to install Rust." >&2; exit 2; }
@ -26,9 +27,10 @@ if ! command -v cargo >/dev/null 2>&1; then
export RUSTUP_UPDATE_ROOT="${RUSTUP_UPDATE_ROOT:-https://rsproxy.cn/rustup}" export RUSTUP_UPDATE_ROOT="${RUSTUP_UPDATE_ROOT:-https://rsproxy.cn/rustup}"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
fi fi
export PATH="$HOME/.cargo/bin:$PATH"
export CARGO_REGISTRIES_CRATES_IO_PROTOCOL="${CARGO_REGISTRIES_CRATES_IO_PROTOCOL:-sparse}" export CARGO_REGISTRIES_CRATES_IO_PROTOCOL="${CARGO_REGISTRIES_CRATES_IO_PROTOCOL:-sparse}"
export CARGO_REGISTRIES_CRATES_IO_INDEX="${CARGO_REGISTRIES_CRATES_IO_INDEX:-sparse+https://rsproxy.cn/index/}" export CARGO_REGISTRIES_CRATES_IO_INDEX="${CARGO_REGISTRIES_CRATES_IO_INDEX:-sparse+https://rsproxy.cn/index/}"
export CARGO_SOURCE_CRATES_IO_REPLACE_WITH="${CARGO_SOURCE_CRATES_IO_REPLACE_WITH:-rsproxy}"
export CARGO_SOURCE_RSPROXY_REGISTRY="${CARGO_SOURCE_RSPROXY_REGISTRY:-sparse+https://rsproxy.cn/index/}"
if ! command -v corepack >/dev/null 2>&1; then if ! command -v corepack >/dev/null 2>&1; then
npm install --global corepack npm install --global corepack