Mounting DMGs w/ HFS partitions:
http://linuxforums.org.uk/index.php?topic=1072.0
apt-get install hfsplus hfsutils hfsprogs dmg2img
dmg2img image.dmg image.img
An HFS+/HFSX partition starts with 1024 reserved bytes (for boot code), followed by the volume header.
The first 4 bytes of the volume header are a signature and a version number:
-
"H+" followed by version 4 = HFS
-
"HX" followed by version 5 = HFSX
Search raw img for either HFS+ or HFSX header
-
"48 2b 00 04"
= HFS+ -
"48 58 00 05"
= HFSX -
hexdump -C image.img | grep "48 2b 00 04"
Subtract 1024 bytes to find the beginning of the partition
expr $(printf "%d" 0x<ADDRESS FROM HEXDUMP>) - 1024
Get the offset in a one-liner using first found match for HFS+ volume header in SOURCE.img:
expr $(printf "%d" 0x$(hexdump -C SOURCE.img | grep -m 1 "48 2b 00 04" | awk '{print $1}')) - 1024
Setup .img as a block device:
losetup -o <CALCULATED OFFSET IN DEC> /dev/loop0 image.img
Mount the block device:
mount -t hfsplus /dev/loop0 /mnt
apt-get install -y build-essentials git autoconf libxml2-dev libcurl4-openssl-dev python2.7 libbz2-dev liblzma-dev
git clone https://github.com/mackyle/xar.git
cd xar
./autogen.sh
./configure --with-bzip2 --with-lzma=/usr
make
make install
PBZX-wrapped Payload (as of OS X 10.10) needs extra processing if:
file path/to/Payload
> path/to/Payload: data
Use Michael Lynn's Python script to remove PBZX wrapper: https://gist.github.com/pudquick/ff412bcb29c9c1fa4b8d
xar -x -f /mnt/SOME.pkg path/to/Payload
file path/to/Payload
> path/to/Payload: data
parsepbzx.py path/to/Payload
file /Payload.cpio.xz
> Payload.cpio.xz: XZ compressed data
xz -d /Payload.cpio.xz
file /Payload.cpio
> Payload.cpio: ASCII cpio archive (pre-SVR4 or odc)
cpio -i --list -I /Payload.cpio
>.
>./System
>./System/Library
>./System/Library/Input Methods
>./usr
>./Library
git clone https://github.com/hogliux/bomutils.git
make
make install