fix(agent): fall back to install record for sing-box core version (item 12)
Locally built sing-box v1.13.21 carries no version stamp and reports 'unknown', leaving the panel core-version column empty. The agent probe now falls back to /etc/nexusgate/sing-box/version when the binary reports no version; agent-singbox.sh writes that record (version without the v prefix) on every successful install path, including the already-installed early exit. Agent version stays 0.6.8.
This commit is contained in:
@@ -9,7 +9,16 @@ set -Eeuo pipefail
|
||||
version='v1.13.21'
|
||||
target='/usr/local/bin/nexusgate-sing-box'
|
||||
stats_target='/usr/local/bin/nexusgate-sing-box-stats'
|
||||
# The locally built sing-box carries no version stamp (`sing-box version`
|
||||
# prints "unknown"), so the agent cannot probe the core version from the
|
||||
# binary. Record the installed version (without the leading v) for the
|
||||
# agent's fallback probe — see agent-go installedSingBoxVersion.
|
||||
write_version_record() {
|
||||
install -d -m 0700 /etc/nexusgate/sing-box
|
||||
printf '%s\n' "${version#v}" > /etc/nexusgate/sing-box/version
|
||||
}
|
||||
if [[ -x "$target" && -x "$stats_target" && "${2:-}" != '--force' ]]; then
|
||||
write_version_record
|
||||
printf 'sing-box 已安装:%s(如需重装,运行 ng-agent-singbox install --force)\n' "$target"
|
||||
exit 0
|
||||
fi
|
||||
@@ -38,6 +47,7 @@ try_prebuilt() {
|
||||
install -m 0755 "$tmp_stats" "${stats_target}.next"
|
||||
mv -f "${target}.next" "$target"
|
||||
mv -f "${stats_target}.next" "$stats_target"
|
||||
write_version_record
|
||||
printf 'sing-box 预编译版安装完成:%s\n' "$target"
|
||||
return 0
|
||||
fi
|
||||
@@ -104,6 +114,7 @@ install -m 0755 "$build_dir/sing-box" "$target.next"
|
||||
install -m 0755 "$build_dir/stats-query" "$stats_target.next"
|
||||
mv -f -- "$target.next" "$target"
|
||||
mv -f -- "$stats_target.next" "$stats_target"
|
||||
write_version_record
|
||||
printf 'sing-box 统计版已安装:%s\n' "$target"
|
||||
if [[ -f /etc/nexusgate/sing-box/config.json ]]; then
|
||||
if command -v systemctl >/dev/null && [[ -d /run/systemd/system ]]; then
|
||||
|
||||
Reference in New Issue
Block a user