Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- scripts/dockershell | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 scripts/dockershell
diff --git a/scripts/dockershell b/scripts/dockershell new file mode 100755 index 0000000000..f6a2276172 --- /dev/null +++ b/scripts/dockershell @@ -0,0 +1,30 @@ +#! /bin/sh + +# This script starts a docker shell with QEMU directory mounted +# +# Copyright (C) 2017 Philippe Mathieu-Daudé. GPLv2+. +# +# Usage: +# ./scripts/dockershell qemu:debian-bleeding-dev + +if [ $# -lt 1 ]; then + echo + echo "error: missing image name" + echo + docker images qemu --no-trunc --format="- {{.Repository}}:{{.Tag}}" + exit 1 +fi + +SDIR=$(cd "$(dirname "$0")/.." && pwd -P) +CDIR=$(pwd -P) + +VOLS="-v /tmp:/tmp" +if [ "${SDIR}" = "${CDIR}" ]; then + VOLS="${VOLS} -v ${SDIR}:${SDIR} -w ${SDIR}" +else + VOLS="${VOLS} -v ${SDIR}:${SDIR}:ro -v ${CDIR}:${CDIR} -w ${CDIR}" +fi + +docker run --rm -it ${VOLS} \ + -u $(id -u) \ + $1 -- 2.13.3