0

I have created a flat .pkg file with following options on 10.7 using PackageMaker 3.0.6:

/Applications/PackageMaker.app/Contents/MacOS/Package --root ./myroot \
 --id com.myroot.pkg --title "My Root" --scripts ./scripts --target 10.5 \
 --verbose --resources ./resources --root-volume-only --domain system \
 --no-relocate --versio 1.0 --certificate "My Cert Name"

In the resources folder I have background.png, Welcome.rtf and License.rtf and in the scripts folder I have preflight, postflight and various support files for those scripts. The resulting .pkg appears to be fully functional except that the installer does not display my background, welcome or license.

How can I add a custom background, welcome and license to a flat package?

As far as I can tell, the Distribution file in the .pkg is missing references to the background, welcome and license files.

As a workaround I tried using xar. If I unpack the package with xar like so:

xar -xf ./myroot.pkg -C work

and add the 3 tags for those files, then pack it again with xar:

cd work && xar -cf ../myroot2.pkg *

I get a package that starts installation ok with my background etc., but when it comes time to install my .app I get these errors (from /var/log/install.log):

 run preupgrade script for myroot
Could not create task for action: run preupgrade script for myroot2
Install failed: The Installer could not extract files from the package for myroot2. Contact the software manufacturer for assistance.
IFDInstallController 863170 state = 7

I have also tried Flat Package Editor: open myroot.pkg, drag out Distribution, edit it, drag it back, delete old Distribution, save. Same problem as with xar.

I would prefer to have a fully scriptable solution as opposed to using GUIs.

Edit: I have also tried to use pkgutil to expand, edit Distribution, and reflatten a flat package. This gets the icons and readme in the installer, but the installer is then unable to unpack the payload. Same if I reflatten with Flat Package Editor. I have also tried to create an expanded package without PackageMaker (which works, except on 10.8), but when I try to flatten that with pkgutil the result is a corrupted package again.

Heikki Toivonen
  • 30,964
  • 11
  • 42
  • 44

3 Answers3

2

PackageMaker always was buggy has hell, and got deprecated with Mac OS X 10.6 Snow Leopard.

You should use pkgbuild together with productbuild.

Community
  • 1
  • 1
catlan
  • 25,100
  • 8
  • 67
  • 78
  • I have had even less luck with pkgbuild so far. I guess I will need to give it another try if I can't get this approach to work. – Heikki Toivonen Aug 06 '12 at 17:47
  • Well, I'm try to help if you describe the problems you have with pkgbuild. Maybe update the question or start a new one with more details. Did you follow my link step by step? If so where did the trouble start... – catlan Aug 06 '12 at 19:52
  • Even though this did not solve my problem, it is basically equivalent to "it can't be done (at least not like that)", which is useful in itself. So awarding this as the answer. – Heikki Toivonen Nov 14 '13 at 22:13
1

This Mac Installers Blog has some useful posts about Packagemaker including details about the usage and solutions to common problems. Hope it will help.

Vikram Singh
  • 1,726
  • 1
  • 13
  • 25
0

Check out the Luggage - it's a Makefile helper file that lets you create OS X packages with sane Makefiles. Disclaimer: I am the original author for it, though there are a lot of other people's contributions in it now.

Joe Block
  • 1,872
  • 1
  • 12
  • 11