Description
This article provides steps to create a package with a postInstall script using Composer.
Creating a Package with a PostInstall Script
Launch Composer.
Click and drag the .pkg we are trying to build in the lower-left corner of Composer.
Expand the Package under Sources.
Right-click on Scripts and under Add Shell Script choose postinstall.
Paste the script contents we would like to use.
Note: Please be aware that the postinstall script should always start with:
#!/bin/sh ## postinstall
Example postInstall script we will utilize for this workflow:
#!/bin/sh ## postinstall /usr/sbin/installer -pkg /tmp/JamfConnect.pkg -target /
After pasting the script contents in Composer click on File > Compile Script.
Note: Please ensure that the script complies successfully. If it does not Compile successfully, you will likely see this exclamation bubble in Composer. You can easily remedy this by changing line #1 in the script to: "#!/bin/zsh". Full example below:
#!/bin/zsh ## postinstall /usr/sbin/installer -pkg /tmp/JamfConnect.pkg -target /
After the script compiles successfully, please ensure that the Package has the appropriate root:wheel permissions.
Root:wheel permissions workflow can be reviewed at step 8 in https://learn.jamf.com/en-US/bundle/technical-paper-managing-jamf-connect-current/page/Packaging_Files_and_Images_with_Composer.html
Build package by clicking Build as PKG in Composer.