scripts: container.sh: don't add -v twice if unneeded
Subsystems (2)
PATCH v2 1/1 scripts: container.sh: don't add -v twice if unneeded
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.
---
v1 -> v2:
- drop single quotes in double quotes. These were passed literally to podman
--- scripts/container.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/container.sh +5 -1
@@ -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}"
Signature · 1 line
2.39.2
Sascha Hauer
AppliedQuoted 7 lines · 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.
Quoted 8 lines
Signed-off-by Ahmad Fatoum <[email protected]>---
v1 -> v2:
- drop single quotes in double quotes. These were passed literally to podman--- scripts/container.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Applied, thanks
Sascha
Quoted 25 lines
scripts/container.sh +5
-1@@ -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}"Signature · 1 line
2.39.2
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |