mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] scripts: container.sh: don't add -v twice if unneeded
@ 2023-06-19 10:25 Ahmad Fatoum
  0 siblings, 0 replies; only message in thread
From: Ahmad Fatoum @ 2023-06-19 10:25 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The script bind mounts the barebox directory as in $PWD as well as the
realpath into the container to reduce surprises when $PWD contains a
symlinked path. In cases where the path is not symlinked, some podman
versions complain about "duplicate mount destination". Fix this by only
adding the second volume specification, if the path isn't already
canonical.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 scripts/container.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/container.sh b/scripts/container.sh
index eb1e87b59baa..d26f2df68603 100755
--- a/scripts/container.sh
+++ b/scripts/container.sh
@@ -31,9 +31,13 @@ shift $((OPTIND-1))
 
 [ -n "$update" ] && podman pull "$CONTAINER"
 
+volumes="-v '$PWD:$PWD:z'"
 pwd_real=$(realpath $PWD)
+if [ "$(realpath --no-symlinks $PWD)" != "$pwd_real" ]; then
+	volumes="$volumes -v '$pwd_real:$pwd_real:z'"
+fi
 
-exec podman run -it -v "$PWD:$PWD:z" -v "$pwd_real:$pwd_real:z" --rm \
+exec podman run -it $volumes --rm \
 	-e TERM -e ARCH -e CONFIG -e JOBS -e LOGDIR -e REGEX \
 	-e KCONFIG_ADD -w "$PWD" --userns=keep-id \
 	-- "$CONTAINER" "${@:-/bin/bash}"
-- 
2.39.2




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-19 10:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-19 10:25 [PATCH] scripts: container.sh: don't add -v twice if unneeded Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox