Ensure sensor proxy installer configures Pulse env
This commit is contained in:
parent
fa4d5de7bd
commit
1b37de22f6
1 changed files with 19 additions and 17 deletions
|
|
@ -60,6 +60,25 @@ configure_local_authorized_key() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configure_container_proxy_env() {
|
||||||
|
local socket_line="PULSE_SENSOR_PROXY_SOCKET=/mnt/pulse-proxy/pulse-sensor-proxy.sock"
|
||||||
|
if ! SOCKET_LINE="$socket_line" pct exec "$CTID" -- bash <<'EOF'
|
||||||
|
set -e
|
||||||
|
ENV_FILE="/etc/pulse/.env"
|
||||||
|
mkdir -p /etc/pulse
|
||||||
|
if [[ -f "$ENV_FILE" ]] && grep -q "^PULSE_SENSOR_PROXY_SOCKET=" "$ENV_FILE" 2>/dev/null; then
|
||||||
|
sed -i "s|^PULSE_SENSOR_PROXY_SOCKET=.*|$SOCKET_LINE|" "$ENV_FILE"
|
||||||
|
else
|
||||||
|
echo "$SOCKET_LINE" >> "$ENV_FILE"
|
||||||
|
fi
|
||||||
|
chmod 600 "$ENV_FILE" 2>/dev/null || true
|
||||||
|
chown pulse:pulse "$ENV_FILE" 2>/dev/null || true
|
||||||
|
EOF
|
||||||
|
then
|
||||||
|
print_warn "Unable to update /etc/pulse/.env inside container $CTID"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Helper function to safely update allowed_nodes section in config file
|
# Helper function to safely update allowed_nodes section in config file
|
||||||
# Removes any existing allowed_nodes section before adding new one to prevent duplicates
|
# Removes any existing allowed_nodes section before adding new one to prevent duplicates
|
||||||
update_allowed_nodes() {
|
update_allowed_nodes() {
|
||||||
|
|
@ -2472,20 +2491,3 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
# Ensure Pulse inside the container knows where to find the proxy socket.
|
|
||||||
configure_container_proxy_env() {
|
|
||||||
local socket_line="PULSE_SENSOR_PROXY_SOCKET=/mnt/pulse-proxy/pulse-sensor-proxy.sock"
|
|
||||||
pct exec "$CTID" -- bash -lc '
|
|
||||||
set -e
|
|
||||||
ENV_FILE="/etc/pulse/.env"
|
|
||||||
SOCKET_LINE="'"$socket_line"'"
|
|
||||||
mkdir -p /etc/pulse
|
|
||||||
if [[ -f "$ENV_FILE" ]] && grep -q "^PULSE_SENSOR_PROXY_SOCKET=" "$ENV_FILE" 2>/dev/null; then
|
|
||||||
sed -i "s|^PULSE_SENSOR_PROXY_SOCKET=.*|$SOCKET_LINE|" "$ENV_FILE"
|
|
||||||
else
|
|
||||||
echo "$SOCKET_LINE" >> "$ENV_FILE"
|
|
||||||
fi
|
|
||||||
chmod 600 "$ENV_FILE" 2>/dev/null || true
|
|
||||||
chown pulse:pulse "$ENV_FILE" 2>/dev/null || true
|
|
||||||
' >/dev/null 2>&1 || print_warn "Unable to update /etc/pulse/.env inside container $CTID"
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue