Skip to main content
Question

Composer and Installing Apps.

  • September 28, 2020
  • 4 replies
  • 10 views

Forum|alt.badge.img+3

I am using Composer and building a PKG.
The file system is /private/var/Mycompany/Apps/SweetApp.pkg
Then in my POSTINSTALL Script I have.

installer -pkg "$pathToPackage/SweetApp.pkg" -target /

But nothing installs. Do I need Sudo? Do I have to path out /usr/sbin/installer?

4 replies

Forum|alt.badge.img+7
  • Contributor
  • September 28, 2020

try copying your pkg somwhere under /usr/local/YourCompanyApps


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • September 28, 2020

Do I need this at the end or is this for an if statement to return if the install failed or not. exit 0 ## Success
exit 1 ## Failure


Forum|alt.badge.img+7
  • Contributor
  • September 29, 2020

yes, you should keep that at the end of your script in Composer. You can use logic within your script to determine an exit code for instance: after the installer runs, you can capture the exit code from the installation using $?. exitcode=$?
if [ $exitcode -ne 0 ]; then
{ exit 1 }
else
{ exit 0 }
or something like:

installstatus=$?
[ $installstatus ! -eq 0 ] && exit 1


PaulHazelden
Forum|alt.badge.img+12
  • Jamf Heroes
  • September 29, 2020

I end my install commands with -allowUntrusted

/usr/sbin/installer -pkg "$pathToPackage/SweetApp.pkg" -tgt / -allowUntrusted

If that helps