scripts: stable directory matching

2nd go at I30e1f0ec1b2a958decaffab181f3b80a4f37b2ce

Change-Id: Id64776b079bc0e47963630b9f160aafed918b50e
Reviewed-on: https://review.monogon.dev/c/monogon/+/259
Reviewed-by: Sergiusz Bazanski <serge@monogon.tech>
diff --git a/scripts/bin/bazel b/scripts/bin/bazel
index d689cac..aba155b 100755
--- a/scripts/bin/bazel
+++ b/scripts/bin/bazel
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash
 set -euo pipefail
 
-if [[ "$(podman inspect monogon-dev --format "{{ (index .Mounts 0).Source }}")" != "$(pwd)" ]]; then
+if ! podman inspect monogon-dev --format ":{{ range .Mounts }}{{.Source }}:{{ end }}" | grep -q ":$(pwd):"; then
     echo "Please run this wrapper from the original checkout"
     exit 1
 fi