Skip to content

Instantly share code, notes, and snippets.

@pajp
Created November 12, 2014 18:08
Show Gist options
  • Save pajp/214deae2821b27916191 to your computer and use it in GitHub Desktop.
Save pajp/214deae2821b27916191 to your computer and use it in GitHub Desktop.
cp_dmg() {
dmg="$1"
file="$2"
destination="$3"
mountpoint=$(hdiutil attach "$dmg" -nobrowse -plist|xpath '//key[.="mount-point"]/following-sibling::*[1]' 2> /dev/null|sed -e 's/<\/*string>//g')
cp "${mountpoint}/$file" "$destination"
hdiutil detach -quiet "$mountpoint"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment