Created
May 11, 2018 14:42
-
-
Save Gargravarr2112/29f88caf1f511012839eb27e1bd5c0e5 to your computer and use it in GitHub Desktop.
This file contains 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/sh | |
set -eu; | |
inputFile="$1"; | |
if [ ! -f "$1" ]; then | |
echo "$1 is not a file!"; | |
exit 1; | |
fi | |
outputDevice="$2"; | |
if [ ! -b $outputDevice ]; then | |
echo "$2 is not a block device!"; | |
exit 1; | |
fi | |
imageSizeBytes=$(ls --size --block-size=1 "$inputFile" | awk '{print $1}'); | |
dd if="$inputFile" | pv -bpaerts $imageSizeBytes | sudo dd of=$outputDevice; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment