Fix unbound variable error in temperature proxy installation

Related to #681

The variable local_proxy_binary was declared with local scope inside
the BUILD_FROM_SOURCE conditional block but referenced outside of it
during cleanup. This caused "unbound variable" errors on release installs
since the script uses set -u.

Moved the declaration before the conditional block and initialize to empty
string. The cleanup code [[ -f "$local_proxy_binary" ]] already handles
the empty string case safely.
This commit is contained in:
rcourtman 2025-11-10 11:37:31 +00:00
parent 999e598e44
commit 438d3b6b7b

View file

@ -1407,8 +1407,9 @@ fi'; then
# If building from source, copy the binary from the LXC instead of downloading
local proxy_install_args=(--ctid "$CTID" --skip-restart)
local local_proxy_binary=""
if [[ "$BUILD_FROM_SOURCE" == "true" ]]; then
local local_proxy_binary="/tmp/pulse-sensor-proxy-$CTID"
local_proxy_binary="/tmp/pulse-sensor-proxy-$CTID"
print_info "Copying locally-built pulse-sensor-proxy binary from container..."
if pct pull $CTID /opt/pulse/bin/pulse-sensor-proxy "$local_proxy_binary" 2>/dev/null; then
proxy_install_args=(--ctid "$CTID" --local-binary "$local_proxy_binary" --skip-restart)