Hello,
Thank you so much for your reply, it was very thorough and cleared things up quite a bit. Like you say, the information for flat packages and transitioning to them is patchy and available here and there, with answers like this helping quite a bit.
I do have one more question. My last packages has an InstallationCheck script, which returns 0x61 (97) when an installation on an invalid target OS is attempted. The return value comes from here:
"If you set a number from 1 - 15, you get a predefined error message. They are currently set as follows:
1 - Displays message "This software cannot be installed on this computer."
2 - Displays message "The software <blah> cannot be installed on this computer."
3 - Displays message "<blah> cannot be installed on this computer."
4 - Displays message ""An error was encountered while running the InstallationCheck tool for package <blah>."
5 - Displays message about how your system has Tier3, so you can't install. (Tiger and later, only)
6-15 Additional predefine messages supplied by the Installer (currently undefined).
Then set bits 6 and 5 as follows:
Bit 6 Bit 5 Meaning
0 0 Success - Installation to proceed as normal
0 1 Warning - Present the user a warning panel and allow install to proceed.
1 0 Fail Silently - Current package is skipped without showing any feedback.
1 1 Fail installation with error message shown."
http://lists.apple.com/archives/installer-dev/2007/Jul/msg00027.html
The only issue is that I cannot find a way to get the InstallationCheck called. I checked the distribution UI section which you so kindly pointed out, but I didn't find any way to reference it. I wonder if this approach is deprecated, because I can't seem to find a way to get this done. Now from what I see so far there are two possible options:
a) Use the "Return of script" requirement to fail, but this doesn't have a localized error (the InstallationCheck errors were localized, I believe).
b) Try to hack the distribution section from the command line- could not find any information on Google pertaining to this.
Are there any other options?
Thanks again,
Philip Lukidis
From: Julian Devlin [mailto:email@hidden]
Sent: Tuesday, July 31, 2012 3:09 PM
To: Philip Lukidis
Cc: email@hidden
Subject: Re: Flat Packages, Gatekeeper, and Resources
I'll attempt to answer since:
1. I just wasted a week on this
2. Maybe if I'm incorrect about something, someone will correct me and I'll learn something too...
3. It amazes me that there's hardly anything on the subject of going from bundled to flat that I could find on google
a) Is there are way that I could re-incorporate them (readme, welcome, etc) into the user experience and sign my package so that Gatekeeper will not complain?
Build a distribution package.
If you're using the PackageMaker UI and a PackageMaker document, get this configured by clicking "Edit Interface" in the upper right.
If you're trying to use PackageMaker on the command line you'll probably end up using xar to open up a flat package, modify it, and re-xar it. Distributions can have a folder named Resources. The file named "Distribution" specifies file names, e.g.:
<background file="background" alignment="topleft" scaling="none"/>
<welcome file="Welcome"/>
b) Is it true that only flat packages can be signed?
That's my understanding, though this seems like an artificial restriction to me, to force adoption of newer OS's.
c) When I select 10.5 as the minimum OS, the postflight option disappears from the UI, but it still seems to execute. Why? Should I switch to postinstall instead?
d) Are postupgrade and preupgrade valid for flat packages? Or is there no difference between postinstall/upgrade and preinstall/upgrade?
As I understand it, flat packages (single components with no distribution) can have a preinstall and a postinstall. These are equivalent to the old preflight/postflight - they run on every install regardless of what version is or is not already installed.
A distribution can't have a preinstall/postinstall. But the PackageMaker UI has an "Actions" tab for the distribution. Configuring things in this tab just creates a "dummy" sub-pkg that exists merely so that it can have a preinstall/postinstall. Also, the actions have some common tasks that you might want to do, and they'll set up the necessary scripts.
For a pkg within a distribution, you can use the Scripts tab. If you give it a directory it will automatically look for files named preinstall and postinstall, and will populate the pre/post install fields if it finds them. But you can also have scripts with different names and specify them in pre/post install fields.
Some Apple page suggested that actions in a distribution are more "secure" than scripts in a component package - but based on examining what was produced it seems that the mechanism is in fact identical.
e) Are flat packages and distribution packages fundamentally different?
Distribution package seems conceptually to be more or less like an old mpkg.
But it seems you must use a distribution package to get welcome / background / etc.
Oh yeah, two more gripes about the newer format:
1. No way to get info on a flat package and see version information
2. No more "restart recommended"
Anyone else out there, please correct me if I'm mistaken on any of this...