Skip to main content
Question

Use Composer to call scripts

  • June 17, 2016
  • 3 replies
  • 9 views

ImAMacGuy
Forum|alt.badge.img+23

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

Forum|alt.badge.img+15
  • Contributor
  • 589 replies
  • June 17, 2016

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
Forum|alt.badge.img+35
  • Hall of Fame
  • 1799 replies
  • June 17, 2016

@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.


Forum|alt.badge.img+14
  • Contributor
  • 270 replies
  • June 17, 2016

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.