Files
linux-workspace/bin/sd-copy
2022-10-16 19:04:05 +02:00

19 lines
387 B
Bash
Executable File

#!/usr/bin/env bash
set -E -o errexit -o nounset -o pipefail
if [ $# -lt 2 ]; then
echo "Not enough arguments!"
echo "Use: $0 <source> <destination> [args]"
echo "For example: $0 ubuntu.img /dev/sdc"
exit 10
fi
SRC="$1"
shift
DST="$1"
shift
echo "dd if=$SRC of=$DST bs=32MiB status=progress conv=fsync $*"
sudo dd if="$SRC" of="$DST" bs=32MiB status=progress conv=fsync "$@"