diff --git a/inspect/serial-log/Dockerfile b/inspect/serial-log/Dockerfile new file mode 100644 index 0000000..a1f778d --- /dev/null +++ b/inspect/serial-log/Dockerfile @@ -0,0 +1,19 @@ +FROM debian:stable-slim + +# set up base package requirements for can device +RUN ( \ + set -e; \ + apt-get --yes --quiet update; \ + apt-get install --yes --quiet \ + tio \ + ; \ + apt-get --yes --quiet clean; \ +) + +# set workdir to /usr/src/env +WORKDIR /usr/src/env + +# copy init.sh to workdir +COPY init.sh ./ + +ENTRYPOINT ["/bin/bash", "init.sh"] diff --git a/inspect/serial-log/build.sh b/inspect/serial-log/build.sh new file mode 100755 index 0000000..24287cd --- /dev/null +++ b/inspect/serial-log/build.sh @@ -0,0 +1,2 @@ +#!/bin/bash +docker build --platform arm64 --tag inspect/serial-log . diff --git a/inspect/serial-log/init.sh b/inspect/serial-log/init.sh new file mode 100755 index 0000000..87206b9 --- /dev/null +++ b/inspect/serial-log/init.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -x + +SERIAL_DEV=$1 +DEV_NAME=$(basename "${SERIAL_DEV}") +tio -m INLCRNL --log --log-file "serial-log.${DEV_NAME}" "${SERIAL_DEV}" diff --git a/inspect/serial-log/run.sh b/inspect/serial-log/run.sh new file mode 100755 index 0000000..d2cb5a6 --- /dev/null +++ b/inspect/serial-log/run.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -x + +SERIAL_DEV="$1" +DEV="--device $1:$1" +docker run --rm -it --network=host --privileged ${DEV} -v $PWD:/usr/src/env/ext-dir inspect/serial-log $1 diff --git a/run-remote b/run-remote new file mode 100755 index 0000000..84bdffc --- /dev/null +++ b/run-remote @@ -0,0 +1,13 @@ +#!/bin/bash + +IMAGE="$1" +shift + +TARGET="$1" +shift + +IMAGE_BASENAME=$(basename "${IMAGE}") +docker save -o "/tmp/${IMAGE_BASENAME}" "${IMAGE}" +rsync -av --progress "/tmp/${IMAGE_BASENAME}" "${IMAGE}/run.sh" "${TARGET}:/tmp" +ssh "${TARGET}" docker load -i "/tmp/${IMAGE_BASENAME}" +ssh -t "${TARGET}" /tmp/run.sh $@