diff --git a/install.sh b/install.sh index bd86d4c29..ac72d0cfc 100755 --- a/install.sh +++ b/install.sh @@ -1576,7 +1576,7 @@ fi'; then 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) + proxy_install_args=(--ctid "$CTID" --local-binary "$local_proxy_binary" --skip-restart --pulse-server "http://${IP}:${frontend_port}") print_info "Using locally-built binary from container" else print_warn "Failed to copy binary from container, will try fallback download" diff --git a/scripts/install-sensor-proxy.sh b/scripts/install-sensor-proxy.sh index 26a4117a3..5149f01ea 100755 --- a/scripts/install-sensor-proxy.sh +++ b/scripts/install-sensor-proxy.sh @@ -111,7 +111,46 @@ update_allowed_nodes() { done # Remove any existing allowed_nodes block (including descriptive comments) to prevent duplicates - perl -0pi -e 's/(?:^[ \t]*#[^\n]*\n)*allowed_nodes:\n(?:(?:[ \t]+-[^\n]*|[ \t]*#[^\n]*)\n)*//mg' "$config_file" 2>/dev/null || true + local tmp_config + tmp_config=$(mktemp) + if awk ' + BEGIN { skip=0; pending_count=0 } + function flush_pending() { + for (i=1; i<=pending_count; i++) print pending[i] + pending_count=0 + } + { + if (skip) { + if ($0 ~ /^[[:space:]]*$/ || $0 ~ /^[[:space:]]*#/ || $0 ~ /^[[:space:]]*-[[:space:]]*/) { + next + } + skip=0 + } + if ($0 ~ /^[[:space:]]*allowed_nodes:[[:space:]]*$/) { + pending_count=0 + skip=1 + next + } + if ($0 ~ /^[[:space:]]*$/ || $0 ~ /^[[:space:]]*#/) { + pending[++pending_count]=$0 + next + } + if (pending_count > 0) { + flush_pending() + } + print + } + END { + if (!skip && pending_count > 0) { + flush_pending() + } + } + ' "$config_file" > "$tmp_config"; then + mv "$tmp_config" "$config_file" + else + rm -f "$tmp_config" + print_warn "Failed to sanitize existing allowed_nodes block; duplicates may remain" + fi { echo ""