fix(flat): don't use pkgbuild
for MAS distributions
#340
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #327
Fixes #328
Fixes electron/forge#3782
Context
The
flat
function of@electron/osx-sign
is used to generate.pkg
archives for macOS. These archives can be installed on users' machines in two ways:.pkg
archive on your file system)There are two underlying macOS tools that can be used to generate these archives:
productbuild
andpkgbuild
.Regression
#282 fixed the problem of not being to use pre/postinstall scripts in
.pkg
installers by adding an additionalpkgbuild
incantation to add those scripts and inserting that build into the finalproductbuild
bundle.It turns out that this created invalid output for MAS build targets. This is because
pkgbuild
isn't supposed to be used for Mac App Store builds according to the manpage:Solution
My proposed solution is to branch between the previous and current implementation based on the build target (MAS vs. OS X Installer). This will fix the regression for MAS builds while still preserving the ability to add pre/postinstall scripts for OS X Installer archives.
It turns out that pre/postinstall scripts are a non-feature for MAS builds anyways according to both Apple Developer Technical Support 1 and the
productbuild
manpage 2.