简体   繁体   中英

macos pkg: How to log bash errors

I have a macos app with a pkg installer. The pkg has a postinstall.sh and a preinstall.sh.

On most machines it works fine but for certain customers I get reports that the script has failed.

I've asked the users to send me the installer logs but those don't contain the actual bash error only something like this:

Sep 14 15:04:16 Filestars-Mac-Mini installd[2540]: PackageKit: Install Failed: Error Domain=PKInstallErrorDomain Code=112 "An error occurred while running scripts from the package “Filestar.21.0.12.0.osx-x64.pkg”." UserInfo={NSFilePath=./preinstall, NSURL=file:///Users/filestar/repos/Filestar/Filestar.Installer/macOs/Output/Filestar.21.0.12.0.osx-x64.pkg#Filestar.pkg, PKInstallPackageIdentifier=com.Filestar.pkg.Filestar, NSLocalizedDescription=An error occurred while running scripts from the package “Filestar.21.0.12.0.osx-x64.pkg”.} { NSFilePath = "./preinstall"; NSLocalizedDescription = "An error occurred while running scripts from the package \U201cFilestar.21.0.12.0.osx-x64.pkg\U201d."; NSURL = "file:///Users/filestar/repos/Filestar/Filestar.Installer/macOs/Output/Filestar.21.0.12.0.osx-x64.pkg#Filestar.pkg"; PKInstallPackageIdentifier = "com.Filestar.pkg.Filestar"; }

How can I get the actual error?

During your preinstall.sh and postinstall.sh scripts, append to a log file. For example, you can rm -rf /var/tmp/Filestar.log during preinstall.sh then append anything you deem interesting there. Doing the same for postinstall.sh . Then if the user reports an issue have them send you the log file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM