Composer and Installing Apps.

wlevan
New Contributor II

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 4

DebstepFRB
New Contributor II

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

wlevan
New Contributor II

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

DebstepFRB
New Contributor II

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
Contributor III

I end my install commands with -allowUntrusted

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

If that helps