Created
May 15, 2019 16:38
-
-
Save DamnedFacts/2e1ba1001f6c20ba46f837089b602a0d to your computer and use it in GitHub Desktop.
Mount a VirtualBox Virtual Disk Image (VDI) on a Mac using hdiutil
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 | |
TEMP="$1.$$.img" | |
trap "rm -f $TEMP 2>/dev/null" 1 2 3 11 15 | |
offset=`hexdump -s 0x158 -n 4 "$1" | head -1 | awk '{print $5 $4 $3 $2}'` | |
offset512=`echo "obase=16; ibase=16; $offset / 200" | bc` | |
ln "$1" "$TEMP" | |
hdiutil attach "$TEMP" -nomount -section "0x$offset512" | |
rm -f "$TEMP" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment