Created
December 28, 2019 11:03
-
-
Save apevec/d268601de5a0a6f35ad3859b18367b4d to your computer and use it in GitHub Desktop.
write image file $1 to the device $2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# write image file $1 to the device $2 | |
if [ "${1%.gz}" = "${1}" ]; then | |
if [ "${1%.xz}" = "${1}" ]; then | |
if [ "${1%.zip}" = "${1}" ]; then | |
# Assuming uncompressed image for the unknown extensions | |
set -x | |
time dd if="$1" of=$2 bs=4M status=progress conv=fsync | |
else | |
set -x | |
time unzip -p "$1" | dd of=$2 bs=4M status=progress conv=fsync | |
fi | |
else | |
set -x | |
time xzcat "$1" | dd of=$2 bs=4M status=progress conv=fsync | |
fi | |
else | |
set -x | |
time gunzip -c "$1" | dd of=$2 bs=4M status=progress conv=fsync | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment