Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are PackageMaker installations with preinstall scripts broken on Snow Leopard?

Everything worked on 10.5, but now my PackageMaker installation project is broken. I've been fighting a problem for a few days now, and either

  • Snow Leopard (OS X 10.6.1) has broken PackageMaker installations
  • I am lacking a very, very basic tidbit of knowledge

To narrow down the problem, I've gotten to this point:

  1. Create a new PackageMaker installation
  2. Have it install a jpeg image into my home directoy
  3. Define a preinstall script that does nothing
    #!/bin.sh
    exit 0

Run the above...and watch it fail with the below error message like clock work

Sep 14 15:09:45 manoa installd[5620]: PackageKit: ----- Begin install -----
Sep 14 15:09:45 manoa installd[5620]: PackageKit: request=PKInstallRequest <1 packages, destination=/>
Sep 14 15:09:45 manoa installd[5620]: PackageKit: packages=(\n    "PKLeopardPackage <file://localhost/Users/stu/Desktop/asdf.pkg>"\n)
Sep 14 15:09:46 manoa installd[5620]: PackageKit: Extracting /Users/stu/Desktop/asdf.pkg (destination=/var/folders/Hb/HbXJFyEpFaupt5QyLN-pTk+++TI/-Tmp-/PKInstallSandbox-tmp/Root/~, uid=501)
Sep 14 15:09:46 manoa installd[5620]: PackageKit: Executing script "./preinstall" in /private/tmp/PKInstallSandbox.cmlS2H/Scripts/test.test.5year_header.pkg.PFrHNB
Sep 14 15:09:46 manoa installd[5620]: PackageKit: *** launch path not accessible
Sep 14 15:09:46 manoa installd[5620]: PackageKit: Install Failed: PKG: pre-install scripts for "test.test.5year_header.pkg"\nError Domain=PKInstallErrorDomain Code=112 UserInfo=0x100149430 "An error occurred while running scripts from the package “asdf”." {\n    NSFilePath = "./preinstall";\n    NSLocalizedDescription = "An error occurred while running scripts from the package \U201casdf\U201d.";\n    NSURL = "file://localhost/Users/stu/Desktop/asdf.pkg";\n    PKInstallPackageIdentifier = "test.test.5year_header.pkg";\n}
Sep 14 15:09:46 manoa Installer[5614]: install:didFailWithError:Error Domain=PKInstallErrorDomain Code=112 UserInfo=0x1195917c0 "An error occurred while running scripts from the package “asdf”."
Sep 14 15:09:46 manoa Installer[5614]: Install failed: The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.
Sep 14 15:09:47 manoa Installer[5614]: IFDInstallController 144040 state = 7
Sep 14 15:09:47 manoa Installer[5614]: Displaying 'Install Failed' UI.
Sep 14 15:09:47 manoa Installer[5614]: 'Install Failed' UI displayed message:'The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.'.

There is no file in /private/tmp/PKInstallSandbox.cmlS2H/Scripts/test.test.5year_header.pkg.PFrHNB/, which makes me think the problem is with PackageMaker, and not me. But I'm new to the world of OS X software installation, so doubts remain.

So, the question: Is PackageMaker with a preinstall script broken on OS X 10.6? Or is there some requirement regarding preinstall scripts that I do not understand?

like image 892
Stu Thompson Avatar asked Sep 14 '09 13:09

Stu Thompson


2 Answers

I had the same problem and setting the executable permissions for the scripts solved it for me!

pkgutil --expand my.pkg my 
chmod +x my/inner.pkg/Scripts/preinstall 
pkgutil --flatten my my-fixed.pkg 

Found this solution in this thread at golang-nuts groups

like image 83
yairchu Avatar answered Nov 17 '22 23:11

yairchu


"launch path not accessible" may very well have to do with which software is zipping and/or unzipping the PKG.

So, I was having the problem that my postflight script was not running and was causing my PKG to fail. Looking at the installer log (to see this run the PKG in question, then menu item 'Window > Installer Log' and select 'Show All Logs' from drop down) I saw the dreaded 'launch path not accessible' when it was trying to run script (renamed by PackageMaker to 'postflight').

The problem was only showing up on my customer's systems. It was a real stumper as both of my Mac test machines had no problem running the PKG and their environments appeared to be the same as the customer's machines.

Then in an obscure post on a Symantec website I saw that someone discovered that this problem has something to do with how the PKG is being zipped and/or unzipped.

Sure enough. My customer was downloading the PKG from DropBox and the way that DropBox was zipping it corrupted something inside the PKG.

The solution was for me to ZIP the PKG on my system before uploading to DropBox and then everything worked swimmingly.

like image 20
rushkeldon Avatar answered Nov 17 '22 23:11

rushkeldon