Created
September 12, 2017 15:59
-
-
Save erikng/c148b5084f32768568708bd907a85415 to your computer and use it in GitHub Desktop.
Make standalone "universal" FirmwareUpdater package for High Sierra
This file contains hidden or 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 | |
# Based on investigations and work by Pepijn Bruienne | |
# Expects a single /Applications/Install macOS Sierra*.app on disk | |
# Adapted from https://gist.github.com/gregneagle/7c802aef636ac4295536f2e360921bb1 | |
IDENTIFIER="com.foo.FirmwareUpdateStandalone" | |
VERSION=1.0 | |
# find the Install macOS Sierra.app and mount the embedded InstallESD disk image | |
echo "Mounting Sierra ESD disk image..." | |
/usr/bin/hdiutil mount /Applications/Install\ macOS\ Sierra*.app/Contents/SharedSupport/InstallESD.dmg | |
# expand the FirmwareUpdate.pkg so we can copy resources from it | |
echo "Expanding FirmwareUpdate.pkg" | |
/usr/sbin/pkgutil --expand /Volumes/OS\ X\ Install\ ESD/Packages/FirmwareUpdate.pkg /tmp/FirmwareUpdate | |
# we don't need the disk image any more | |
echo "Ejecting disk image..." | |
/usr/bin/hdiutil eject /Volumes/OS\ X\ Install\ ESD | |
# make a place to stage our pkg resources | |
/bin/mkdir -p /tmp/FirmwareUpdateStandalone/scripts | |
# copy the needed resources | |
echo "Copying package resources..." | |
/bin/cp /tmp/FirmwareUpdate/Scripts/postinstall_actions/update /tmp/FirmwareUpdateStandalone/scripts/postinstall | |
/bin/cp -R /tmp/FirmwareUpdate/Scripts/Tools /tmp/FirmwareUpdateStandalone/scripts/ | |
# build the package | |
echo "Building standalone package..." | |
/usr/bin/pkgbuild --nopayload --scripts /tmp/FirmwareUpdateStandalone/scripts --identifier "$IDENTIFIER" --version "$VERSION" /tmp/FirmwareUpdateStandalone/FirmwareUpdateStandalone.pkg | |
# clean up | |
/bin/rm -r /tmp/FirmwareUpdate | |
/bin/rm -r /tmp/FirmwareUpdateStandalone/scripts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I build it but how do I use this? It fails to install directly on my Mac OS Sierra.