Use XDG_RUNTIME_DIR or /tmp fallback for Podman socket dir
/run/user/<uid> is created by PAM/logind and doesn't exist in non-login shells. Fall back to /tmp/podman-<uid> when XDG_RUNTIME_DIR is unset so mkdir always succeeds. https://claude.ai/code/session_01FKCW3FDjNFj6jve4niMFXH
This commit is contained in:
parent
5359c43cb8
commit
26701675f2
1 changed files with 5 additions and 2 deletions
|
|
@ -62,12 +62,15 @@ echo "[hiy] Generated proxy/caddy.json for ${DOMAIN_SUFFIX}"
|
|||
# ── Ensure Podman socket is active ────────────────────────────────────────────
|
||||
# systemctl --user requires a D-Bus session (not available in non-interactive
|
||||
# shells). Use podman system service directly instead.
|
||||
PODMAN_SOCK="/run/user/$(id -u)/podman/podman.sock"
|
||||
# /run/user/<uid> is only created by PAM/logind during a real login session.
|
||||
# Fall back to /tmp when XDG_RUNTIME_DIR is not set.
|
||||
_SOCK_DIR="${XDG_RUNTIME_DIR:-/tmp/podman-$(id -u)}"
|
||||
PODMAN_SOCK="${_SOCK_DIR}/podman.sock"
|
||||
export PODMAN_SOCK
|
||||
export DOCKER_HOST="unix://${PODMAN_SOCK}"
|
||||
if [ ! -S "$PODMAN_SOCK" ]; then
|
||||
echo "[hiy] Starting Podman socket via podman system service…"
|
||||
mkdir -p "$(dirname "$PODMAN_SOCK")"
|
||||
mkdir -p "$_SOCK_DIR"
|
||||
podman system service --time=0 "unix://${PODMAN_SOCK}" &
|
||||
# Wait up to 5 s for the socket to appear
|
||||
for i in 1 2 3 4 5; do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue