Installation failed with postinstall script Mac OSX

2.2k Views Asked by At

I am trying to create package using pkgbuild and product archive using productbuild. Without scripts, the Installer installs the package successfully. But with scripts, it fails. I googled for it, but couldnt' find a working solution that fixes my issues.

pkgbuild --root GameDir --install-location /Applications --component-plist 'info.plist' --scripts ScriptsOSX Game.pkg

The .app name is provided in the info.plist as RootRelativeBundlePath Dictionary value

productbuild --distribution ./Distribution.xml --resources ../Resources --packagepath GamePkgDir GameInstaller.pkg

script in GameDir/ScriptsOSX folder : postinsall.sh

#!/usr/bin/env sh
open /Applications/Contacts.app/
exit 0

Permission : -rwxr-xr-x@ 1 staff 57 Dec 12 19:26 postinstall.sh // Execution permission for all, for testing purposes.

fwiw : When Installation proceeds, it asks for admin password to proceed. Hence I believe it has permission to run the script, in addition to the execution permission.

I attempted first using python script. Though installation succeeded, the script did not execute. I am not sure why. All the examples had shell or perl script as installation script, hence attempting shell script. But installation fails. I am sure it is due to attempt at script execution. But not sure why. Any ideas?

Thanks in advance

Sujatha

EDIT : The info.plist that has post install script goes like this Its is an array of dictionaries, in which one of the key:value pair is : BundlePostInstallScriptPath = postinstall.sh

1

There are 1 best solutions below

0
On

One can always look into /var/log/install.log for more informations.