all Docker envs: add support for connection to host device

This commit is contained in:
Philippe Teuwen 2024-12-18 13:29:50 +01:00
commit f09705868a
73 changed files with 307 additions and 63 deletions

View file

@ -16,6 +16,10 @@ RUN zypper --non-interactive install ocl-icd-devel
# Create rrg user
RUN useradd -ms /bin/bash rrg
RUN passwd -d rrg
ARG UART_GID
# dialout group may already exist on another numeric ID than on host
RUN groupadd -g ${UART_GID} mydialout || true
RUN usermod -aG ${UART_GID} rrg
RUN printf 'rrg ALL=(ALL) NOPASSWD: ALL\n' | tee -a /etc/sudoers
USER rrg

View file

@ -1,3 +1,6 @@
#!/bin/bash
docker build -t "pm3-suse-leap:1.0" .
. docker_conf
UART_PORT="$(../../pm3 --list|head -n1|cut -d' ' -f2)"
UART_GID="$(stat -c '%g' $UART_PORT)"
docker build --build-arg UART_GID="$UART_GID" -t "$DOCKER_IMAGE" .

View file

@ -0,0 +1,2 @@
# sourceme
DOCKER_IMAGE=pm3-suse-leap:1.0

View file

@ -1,4 +1,5 @@
#!/bin/bash
docker rm $(docker ps -aq --filter ancestor=pm3-suse-leap:1.0)
docker image rm pm3-suse-leap:1.0
. docker_conf
docker rm $(docker ps -aq --filter ancestor="$DOCKER_IMAGE")
docker image rm "$DOCKER_IMAGE"

View file

@ -1,3 +1,10 @@
#!/bin/bash
docker run --volume=$(pwd)/../..:/home/rrg/proxmark3 -w /home/rrg/proxmark3 -it pm3-suse-leap:1.0
. docker_conf
UART_PORT="$(../../pm3 --list|grep dev|head -n1|cut -d' ' -f2)"
if [ -n "$UART_PORT" ]; then
DEV="--device=/dev/tty0 --device=$UART_PORT"
else
DEV=""
fi
docker run $DEV --volume="$(pwd)/../..:/home/rrg/proxmark3" -w /home/rrg/proxmark3 -it "$DOCKER_IMAGE"