You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Scott Palmer <sw...@gmail.com> on 2023/02/27 21:39:11 UTC

How to screw up the NetBeans 17 macOS installer post-install script

This is just a heads-up to any keeners like me that hack their own app
bundle for the betas...

I had NB 17-rc3 already installed.. I basically had copied the NB 16
application bundle, changed the info.plist so that it claimed to be 17, and
copied the NB 17-rc3 binary zip contents into the appropriate place to hack
together my own Application bundle.  I do that because during the beta
period macOS bundles are not provided.  I named it "Apache NetBeans 17-rc3"
and placed it beside NB 16 in /Applications/NetBeans.  It was working fine.

I just grabbed the .pkg installer for NB 17.  Quit my NB 17-rc3 hacked
version and tried to run the installer.  If seemed to get most of the way
through and then failed with a generic message that said "The installation
failed.  The Installer encountered an error that caused the installation to
fail. Contact the software manufacturer for assistance."

macOS's install.og contains:

2023-02-27 16:08:08-05 iMac installd[616]: PackageKit
(package_script_service): Preparing to execute script "./postinstall" in
/private/tmp/PKInstallSandbox.o8C3yC/Scripts/org.netbeans.postinstallscripts.FFSYTF
2023-02-27 16:08:08-05 iMac package_script_service[67541]: PackageKit:
Preparing to execute script "postinstall" in
/tmp/PKInstallSandbox.o8C3yC/Scripts/org.netbeans.postinstallscripts.FFSYTF
2023-02-27 16:08:08-05 iMac package_script_service[67541]: Set
responsibility to pid: 14510, responsible_path:
/System/Library/CoreServices/Installer.app/Contents/MacOS/Installer
2023-02-27 16:08:08-05 iMac package_script_service[67541]: Hosted team
responsibility for script set to team:(2GLGAFWEQD)
2023-02-27 16:08:08-05 iMac package_script_service[67541]: PackageKit:
Executing script "postinstall" in
/tmp/PKInstallSandbox.o8C3yC/Scripts/org.netbeans.postinstallscripts.FFSYTF
2023-02-27 16:08:08-05 iMac package_script_service[67541]: ./postinstall:
Complete installation /Applications/NetBeans/Apache NetBeans 17.app
2023-02-27 16:08:08-05 iMac package_script_service[67541]: ./postinstall:
Result of populate_caches.sh : 0
2023-02-27 16:08:08-05 iMac package_script_service[67541]: ./postinstall:
/tmp/PKInstallSandbox.o8C3yC/Scripts/org.netbeans.postinstallscripts.FFSYTF/postinstall:
line 46: cd: */Applications/NetBeans/Apache NetBeans 17.app
<http://17.app>: No such file or directory*
2023-02-27 16:08:08-05 iMac package_script_service[67541]: PackageKit:
Hosted team responsible for script has been cleared.
2023-02-27 16:08:08-05 iMac package_script_service[67541]: Responsibility
set back to self.
2023-02-27 16:08:08-05 iMac install_monitor[14521]: Re-included:
/Applications, /Library, /System, /bin, /private, /sbin, /usr
2023-02-27 16:08:08-05 iMac installd[616]: PackageKit: releasing backupd
2023-02-27 16:08:08-05 iMac installd[616]: PackageKit: allow user idle
system sleep
2023-02-27 16:08:08-05 iMac installd[616]: PackageKit: Install Failed:
Error Domain=PKInstallErrorDomain Code=112 "An error occurred while running
scripts from the package “Apache NetBeans 17.pkg”."
UserInfo={NSFilePath=./postinstall,
NSURL=file://localhost/Volumes/Apache%20NetBeans%2017/Apache%20NetBeans%2017.pkg#postinstallscripts.pkg,
PKInstallPackageIdentifier=org.netbeans.postinstallscripts,
NSLocalizedDescription=An error occurred while running scripts from the
package “Apache NetBeans 17.pkg”.} {
   NSFilePath = "./postinstall";
   NSLocalizedDescription = "An error occurred while running scripts from
the package \U201cApache NetBeans 17.pkg\U201d.";
   NSURL =
"file://localhost/Volumes/Apache%20NetBeans%2017/Apache%20NetBeans%2017.pkg#postinstallscripts.pkg";
   PKInstallPackageIdentifier = "org.netbeans.postinstallscripts";
}
...
2023-02-27 16:08:09-05 iMac Installer[14510]: 'Install Failed' UI displayed
message:'The Installer encountered an error that caused the installation to
fail. Contact the software manufacturer for assistance.'.

The key part being "/Applications/NetBeans/Apache NetBeans 17.app: No such
file or directory"

Now isn't the installer supposed to make this?  I thought yes, but I
suspect things were redirected to  "/Applications/NetBeans/Apache NetBeans
17-rc3.app" during the install because of my hack to the info.plist file.
Apple is generally clever about letting users drag bundles around and still
being able to find them.  I think it did something along the lines of "I
know they want to install NB 17, and this bundle claims to be that, so we
better update that bundle instead of using the default path. Otherwise the
user will be confused."

Moral of the story - don't hack an info.plist file for beta builds. (Or if
you do, delete it before you install the final build.)

After I deleted my Frankenstein 17-rc3 application bundle, the installer
worked fine.


Scott