Skip to content

Instantly share code, notes, and snippets.

@erikng
Created September 12, 2017 15:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save erikng/c148b5084f32768568708bd907a85415 to your computer and use it in GitHub Desktop.
Save erikng/c148b5084f32768568708bd907a85415 to your computer and use it in GitHub Desktop.
Make standalone "universal" FirmwareUpdater package for High Sierra
#!/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
@ashishb
Copy link

ashishb commented Apr 15, 2018

Hi,

I build it but how do I use this? It fails to install directly on my Mac OS Sierra.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment