#!/usr/bin/env bash # Copy a file to the Cardputer's SD card over USB serial, e.g. an Update File into /updates. # Usage: scripts/sd_put.sh [card path] (default card path: /updates/) set -euo pipefail source "$(dirname "$0")/_docker.sh" [ -f "${1:-}" ] || { echo "Usage: scripts/sd_put.sh [card path]" >&2; exit 1; } docker rm -f roro9stack-serial >/dev/null 2>&1 || true # a serial log would hold the port FILE="$(realpath "$1")" DOCKER_EXTRA=(-e SD_PUT_DEBUG="${SD_PUT_DEBUG:-}" --group-add "$(getent group dialout | cut -d: -f3)" --privileged -v /dev:/dev -v "$(dirname "$FILE"):/in:ro") run_in_container /pio/penv/bin/python scripts/sd_put.py "/in/$(basename "$FILE")" "${@:2}"