mirror of
https://github.com/therealaleph/MasterHttpRelayVPN-RUST.git
synced 2026-05-17 21:24:48 +03:00
6c5b62e5e6
A user on OpenWRT x86_64 reported the linux release doesn't run there — root cause was glibc vs musl mismatch (our gnu binary was looking for a dynamic linker that doesn't exist on router userlands). Add two musl targets that produce fully static PIE binaries: - x86_64-unknown-linux-musl -> mhrv-rs-linux-musl-amd64.tar.gz - aarch64-unknown-linux-musl -> mhrv-rs-linux-musl-arm64.tar.gz CI uses the messense/rust-musl-cross docker images (better-maintained than cargo-zigbuild with a pinned zig, which has version regressions on the ar wrapper between 0.13 and 0.16). Locally verified: - both archs cross-compile green in docker - resulting x86_64 binary (3.3 MB) runs in an alpine:latest container, --version / --help work, no dynamic lib requirements The musl archive skips the UI (routers are headless) and swaps run.sh for a procd init script (assets/openwrt/mhrv-rs.init) expecting the binary at /usr/bin/mhrv-rs and config at /etc/mhrv-rs/config.json. Side effect: switched tokio-rustls to default-features=false + ring (was pulling aws-lc-rs transitively, which can't easily cross-compile for musl). The main crate already uses ring explicitly, so no runtime behavior change. README gets a 'Running on OpenWRT (or any musl distro)' section in both English and Persian with scp + procd enable/start recipe. Closes #2.
34 lines
749 B
Bash
34 lines
749 B
Bash
#!/bin/sh /etc/rc.common
|
|
# OpenWRT procd init script for mhrv-rs.
|
|
# Install as /etc/init.d/mhrv-rs, then:
|
|
# /etc/init.d/mhrv-rs enable
|
|
# /etc/init.d/mhrv-rs start
|
|
#
|
|
# Expects:
|
|
# /usr/bin/mhrv-rs (the static musl binary from the release)
|
|
# /etc/mhrv-rs/config.json (your config)
|
|
|
|
START=99
|
|
USE_PROCD=1
|
|
|
|
BIN=/usr/bin/mhrv-rs
|
|
CONFIG=/etc/mhrv-rs/config.json
|
|
|
|
start_service() {
|
|
[ -x "$BIN" ] || return 1
|
|
[ -f "$CONFIG" ] || return 1
|
|
|
|
procd_open_instance
|
|
procd_set_param command "$BIN" --config "$CONFIG" --no-cert-check
|
|
procd_set_param respawn 3600 5 5
|
|
procd_set_param stdout 1
|
|
procd_set_param stderr 1
|
|
procd_set_param file "$CONFIG"
|
|
procd_close_instance
|
|
}
|
|
|
|
reload_service() {
|
|
stop
|
|
start
|
|
}
|