v0.43.1
This commit is contained in:
1 parent
5b6d4a7903
commit
4d1087e357
160 files changed
+2407
-1933
No files matched your search
@@ -1,6 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Debian 13+ one-line bootstrap for first install or safe source update.
|
||||
# Builds as an unprivileged user, then delegates host changes to install.sh/update.sh.
|
||||
set -euo pipefail
|
||||
|
||||
REPO_URL="${RUSTPROXY_REPO_URL:-https://git.linuxiarz.pl/gru/RustProxy.git}"
|
||||
@@ -83,10 +81,6 @@ if [[ -n ${SUDO_USER:-} && ${SUDO_USER} != root ]] && id "${SUDO_USER}" >/dev/nu
|
||||
builder_home=$(getent passwd "$builder" | cut -d: -f6)
|
||||
else
|
||||
builder=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
|
||||
@@ -121,14 +115,12 @@ run_builder() {
|
||||
|
||||
run_builder git clone --depth 1 "$REPO_URL" "$work/RustProxy"
|
||||
|
||||
# The unprivileged builder owns its rustup toolchain; system compilers are left untouched.
|
||||
if ! run_builder bash -c 'command -v rustup >/dev/null 2>&1'; then
|
||||
echo "Installing rustup for build user: $builder"
|
||||
run_builder env RUSTUP_INIT_SKIP_PATH_CHECK=yes bash -c \
|
||||
'set -o pipefail; wget -qO- --https-only --secure-protocol=TLSv1_2 https://sh.rustup.rs | sh -s -- -y --profile minimal --no-modify-path --default-toolchain none'
|
||||
fi
|
||||
|
||||
# Read the required Rust version and channel from the checked-out sources.
|
||||
rust_settings=$(python3 - "$work/RustProxy" <<'PY_RUST'
|
||||
import pathlib
|
||||
import re
|
||||
@@ -162,7 +154,6 @@ PY_RUST
|
||||
required_rust=${rust_settings%%|*}
|
||||
build_toolchain=${rust_settings#*|}
|
||||
|
||||
# Compare numerically (1.100 > 1.99); do not use lexicographic ordering.
|
||||
rust_version_at_least() {
|
||||
python3 - "$1" "$2" <<'PY_VERSION'
|
||||
import sys
|
||||
@@ -177,7 +168,6 @@ sys.exit(0 if version(sys.argv[1]) >= version(sys.argv[2]) else 1)
|
||||
PY_VERSION
|
||||
}
|
||||
|
||||
# rustup run is a non-updating check: it fails when the channel is missing.
|
||||
installed_rust=$(run_builder rustup run "$build_toolchain" rustc --version 2>/dev/null | awk '$1 == "rustc" { print $2; exit }' || true)
|
||||
if [[ -z "$installed_rust" ]] || ! rust_version_at_least "$installed_rust" "$required_rust"; then
|
||||
echo "Rust toolchain '$build_toolchain' needs installation/update (installed: ${installed_rust:-none}; required: >= $required_rust)."
|
||||
@@ -186,7 +176,6 @@ if [[ -z "$installed_rust" ]] || ! rust_version_at_least "$installed_rust" "$req
|
||||
run_builder rustup update "$build_toolchain"
|
||||
;;
|
||||
*)
|
||||
# Never silently override a pinned toolchain older than rust-version.
|
||||
if [[ -n "$installed_rust" ]]; then
|
||||
echo "Pinned toolchain '$build_toolchain' is older than rust-version $required_rust; fix rust-toolchain.toml in the repository." >&2
|
||||
exit 1
|
||||
@@ -203,7 +192,6 @@ fi
|
||||
run_builder rustup run "$build_toolchain" cargo --version
|
||||
echo "Building with Rust $installed_rust ($build_toolchain); required >= $required_rust."
|
||||
|
||||
# Lighter release settings keep builds within RAM limits on small VPSes.
|
||||
BUILD_JOBS="${RUSTPROXY_BUILD_JOBS:-1}"
|
||||
if ! [[ "$BUILD_JOBS" =~ ^[1-9][0-9]*$ ]]; then
|
||||
echo "RUSTPROXY_BUILD_JOBS must be a positive integer." >&2
|
||||
@@ -214,9 +202,6 @@ 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
|
||||
@@ -246,7 +231,6 @@ if [[ "$MODE" == install ]]; then
|
||||
printf 'Administration is loopback-only by default. Use an SSH tunnel or enable Administration HTTPS before remote exposure.\n'
|
||||
fi
|
||||
else
|
||||
# update.sh preserves the saved data directory, binds and service account.
|
||||
bash update.sh \
|
||||
--binary target/release/rust-proxy \
|
||||
--prefix "$PREFIX"
|
||||
|
||||
Reference in new issue
Block a user