Use Composer to call scripts

jwojda
Valued Contributor II

I'm trying to bundle 3 installs into 1 pkg using composer. It needs to call an install script for each install. I added all 3 to a post flight script, but it doesn't seem to run them..

#!/bin/sh

cd /tmp/Threat-Prevention
./PkgInstallScript

cd /tmp/Firewall
./PkgInstallScript

Cd /tmp/Web-Control
./PkgInstallScript

exit 0      ## Success
exit 1      ## Failure
3 REPLIES 3

thoule
Valued Contributor II

I often have Composer drop my installer into /tmp/myTempInstallerStuff, then run a post install script such as:

tmpinstallfolder=/private/tmp/myTempInstallerStuff/

/usr/sbin/installer -pkg ${tmpinstallfolder}Package.pkg -target /
/usr/sbin/installer -pkg ${tmpinstallfolder}Package2.pkg -target /

rm -rf /tmp/myTempInstallerStuff

stevewood
Honored Contributor II
Honored Contributor II

@jwojda rather than changing into the directory, call the script directly:

/tmp/Threat-Prevention/PkgInstallScript
/tmp/Firewall/PkgInstallScript
/tmp/Web-Control/PkgInstallScript

That should work.

Josh_Smith
Contributor III

This probably isn't the issue because you would have seen a warning message, but just in case make sure you are using a postinstall and not a postflight script for a flat package...and of course build it as a .pkg not a DMG. If you are installing to a drive that you aren't booted to (Casper Imaging) you may have issues with those paths.