This commit is contained in:
Mateusz Gruszczyński committed 2026-11-28 15:54:56 +01:00
1 parent 9a6c21fa04
commit 5b6d4a7903
41 files changed
+3299 -677

No files matched your search

+23 -1
View File
@@ -83,10 +83,25 @@ if [[ -n ${SUDO_USER:-} && ${SUDO_USER} != root ]] && id "${SUDO_USER}" >/dev/nu
builder_home=$(getent passwd "$builder" | cut -d: -f6)
else
builder=rustproxy-build
builder_home=/var/tmp/rustproxy-build
# Not under /var/tmp: Debian 13 ages files there after 30 days
# (systemd-tmpfiles), which removes rarely read files from the builder's
# rustup toolchain and Cargo source cache and breaks later builds with
# errors such as "can't find `example` bin at src/bin/example.rs".
builder_home=/var/lib/rustproxy-build
legacy_builder_home=/var/tmp/rustproxy-build
if ! id "$builder" >/dev/null 2>&1; then
useradd --create-home --home-dir "$builder_home" --shell /bin/bash "$builder"
created_builder=1
else
current_builder_home=$(getent passwd "$builder" | cut -d: -f6)
if [[ "$current_builder_home" != "$builder_home" ]]; then
echo "Moving the build user's home to $builder_home (a fresh Rust toolchain is installed once)."
install -d -m 0700 -o "$builder" -g "$(id -gn "$builder")" "$builder_home"
usermod -d "$builder_home" "$builder"
if [[ "$current_builder_home" == "$legacy_builder_home" ]]; then
rm -rf -- "$legacy_builder_home"
fi
fi
fi
fi
@@ -199,6 +214,13 @@ if [[ "$ALLOW_REMOTE_ADMIN" != "0" && "$ALLOW_REMOTE_ADMIN" != "1" ]]; then
exit 1
fi
# Extracted crate sources are a cache: Cargo re-extracts them from the
# checksum-verified .crate archives, so a damaged or partly removed copy
# (interrupted build, temp-file cleanup) cannot break the build.
if [[ "$builder" == rustproxy-build ]]; then
run_builder rm -rf -- "$builder_home/.cargo/registry/src" "$builder_home/.cargo/git/checkouts"
fi
run_builder env RUSTUP_TOOLCHAIN="$build_toolchain" \
CARGO_BUILD_JOBS="$BUILD_JOBS" \
CARGO_PROFILE_RELEASE_LTO=false \