fix: correct logic for rw/ro cases

This commit is contained in:
phoenix 2025-04-17 06:36:42 +01:00
parent 0fe0d427e0
commit e380058907

View File

@ -52,13 +52,16 @@ rw)
fi
check_devuser_attached
exit 0
;;
ro)
if ! podman container exists "$CONTAINER" || ! podman inspect -f '{{.State.Running}}' "$CONTAINER" | grep -q true; then
echo "❌ Container '$CONTAINER' not running."
if podman container exists "$CONTAINER" && podman inspect -f '{{.State.Running}}' "$CONTAINER" | grep -q true; then
exec podman exec -it --user "$VIEW_USER" "$CONTAINER" tmux attach -r -t "$TMUX_SESSION"
exit 0
else
echo "❌ Container $CONTAINER does not exist."
exit 1
fi
exec podman exec -it --user "$VIEW_USER" "$CONTAINER" tmux attach -r -t "$TMUX_SESSION"
;;
*)
echo "❌ Invalid access mode: $MODE"