Created
July 4, 2014 15:23
-
-
Save pvieito/fa5487d2d8cd3b54ef00 to your computer and use it in GitHub Desktop.
Uses hdiutil to create a raw disk image with .img extension
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
#!/usr/bin/env bash | |
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF | |
Usage: | |
`basename $0` <diskimage> | |
Converts a Disk Image (DMG, ISO) to raw format. | |
EOF | |
exit; fi | |
hdiutil convert -format UDTO $1 -o $1 | |
if [ -f "$1.cdr" ]; then | |
IMAGE="$(echo $1.cdr | sed -E 's/(\..{0,3})?\.cdr$/.img/')" | |
mv "$1.cdr" $IMAGE | |
echo | |
echo Raw Image: $IMAGE | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment