Last active
November 14, 2024 19:12
-
-
Save satmandu/37ce878ba5c3e002b7cb6c3a47aa598a to your computer and use it in GitHub Desktop.
Extract macos dmg with pkg inside from Linux (ubuntu 22.04)
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
# Install build prereqs: | |
sudo apt-get install build-essential libxml2-dev libssl-dev zlib1g-dev | |
# You can extract a dmg using 7z thus: 7z x File.dmg | |
# This installs tools like lsbom to see what is inside bom files | |
git clone https://github.com/hogliux/bomutils && cd bomutils && make && sudo make install | |
# Now install xar so you can extract the pkg file | |
curl -OLf https://opensource.apple.com/tarballs/xar/xar-425.2.tar.gz | |
tar fxv xar-425.2.tar.gz | |
cd xar-xar-425.2/xar/ | |
curl -OLf https://raw.githubusercontent.com/macports/macports-ports/master/archivers/xar/files/xar-1.8-openssl-1.1.patch | |
patch -Np0 -i xar-1.8-openssl-1.1.patch | |
curl -OLf https://github.com/macports/macports-ports/raw/master/archivers/xar/files/xar-1.8-Add-OpenSSL-To-Configuration.patch | |
patch -Np0 -i xar-1.8-Add-OpenSSL-To-Configuration.patch | |
curl -OLf https://github.com/macports/macports-ports/raw/master/archivers/xar/files/xar-1.8-safe_dirname.patch | |
patch -Np0 -i xar-1.8-safe_dirname.patch | |
sed -i 's,filetree.h,../lib/filetree.h,g' src/xar.c | |
sed -i 's,util.h,../lib/util.h,g' src/xar.c | |
autoreconf -fvi | |
./configure | |
make | |
sudo make install | |
# Once you have extracted a File.pkg thus: xar -xvf File.pkg | |
# You can check the contents with lsbom Bom | |
# You can extract the Payload thus: cat Payload | gzip -d | cpio -id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! Changed!