Install sccache during server provision

This commit is contained in:
2026-05-02 23:56:28 +08:00
parent 98c83478ad
commit 4358f38259
3 changed files with 46 additions and 2 deletions

View File

@@ -17,6 +17,14 @@ if [[ -z "${RUSTUP_HOME:-}" && -n "${ORIGINAL_HOME}" && -d "${ORIGINAL_HOME}/.ru
export RUSTUP_HOME="${ORIGINAL_HOME}/.rustup"
fi
# HOME 会在下面切到组件级缓存目录,因此这里先把真实用户的 Rust 工具链目录补进 PATH。
# Server-Provision 通过 cargo install 安装的 sccache 通常会落在 /root/.cargo/bin。
for tool_dir in "${ORIGINAL_HOME}/.cargo/bin" /root/.cargo/bin /usr/local/cargo/bin; do
if [[ -d "${tool_dir}" && ":${PATH}:" != *":${tool_dir}:"* ]]; then
export PATH="${tool_dir}:${PATH}"
fi
done
export HOME="${CARGO_BUILD_HOME}"
export CARGO_HOME
export CARGO_TARGET_DIR