Skip to content

Instantly share code, notes, and snippets.

@oemden
Created July 20, 2019 23:42
Show Gist options
  • Save oemden/18f1a38e47403ade49c9d3eaa02c9144 to your computer and use it in GitHub Desktop.
Save oemden/18f1a38e47403ade49c9d3eaa02c9144 to your computer and use it in GitHub Desktop.
[Convert dmg to iso]
#!/bin/sh
# oem @ oemden dot com
## Convert dmg to iso - need $1 as dmg file. Will basically save .iso in same place as input .dmg
if [[ ! "${1}" ]] ; then
echo "I need a dmg file as input ! Exiting"
exit 1
fi
THISDIR=$(/usr/bin/dirname ${1})
DISKNAME=$( basename "${1}" | sed 's/.dmg//g')
echo "Converting the disk image ${DISKNAME} to an ISO ..."
hdiutil convert "${1}" -format UDTO -o "${THISDIR}/${DISKNAME}"
mv "${THISDIR}/${DISKNAME}".cdr "${THISDIR}/${DISKNAME}".iso
open "${THISDIR}"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment