Adding Scripts to Package Sources

Composer allows you to manage scripts for PKGs. The following default scripts are available in shell and perl:

  • InstallationCheck

  • Postflight

  • Postinstall

  • Postupgrade

  • Preflight

  • Preinstall

  • Preupgrade

  • VolumeCheck

Note: Flat PKGs support Preinstall and Postinstall scripts only. To build a PKG that contains other scripts, you can deselect the Build Flat PKGs option in Composer preferences, or you can disable this preference for a single package. For information on how to disable this preference for a single package, see Building a PKG. For more information on flat PKGs, see Composer Preferences.

These scripts read in the available parameters that are received from the installer and give descriptions for the supported exit codes.

Composer also attempts to verify that the script syntax is valid. If a script appears to have invalid syntax, a warning icon appears.

To view the error that occurred while Composer was verifying the script, Control-click (or right-click) the script and choose Compile Script.

Note: InstallationCheck and VolumeCheck scripts have warning and failure messages that can be localized according to the needs of the user. To localize these messages, the corresponding .strings file (InstallationCheck.strings or VolumeCheck.strings) must be created for each localization.

Adding a postflight script to a package source allows you to remove deprecated or unneeded files from computers as they install the package.

  1. Open Composer and authenticate locally.

  2. Click the disclosure triangle next to the package source in the sidebar.

  3. Do one of the following:

    • To add a postflight script that removes deleted files from computers, click the disclosure triangle next to Snapshots. Then Control-click (or right-click) the Deleted Files heading and choose Add postflight Shell Script.

      Note: This function is only available if a snapshot was used to create the package source.

    • To add another type of script, Control-click (or right-click) Scripts and choose the script you want to add.

      images/download/attachments/49217953/Add_Perl_Script.png

      The script is displayed under the Scripts heading in the sidebar.

  4. (Optional) Select the script in the sidebar to view or change its contents.

Adding a Postflight Script that Removes Deleted Files from Computers

Adding a postflight script to a package source allows you to remove deprecated or unneeded files from computers as they install the package.

Note: This function is only available if a snapshot was used to create the package source.

  1. Open Composer and authenticate locally.

  2. Click the disclosure triangle next to the package source in the sidebar.

  3. Click the disclosure triangle next to Snapshots.

  4. Select the Deleted Files heading to view the deleted files captured by the snapshot.

  5. Control-click (or right-click) the Deleted Files heading and choose Add postflight Shell Script.

    images/download/attachments/49217953/Add_postflight_Shell_Script.png

    The script is displayed under the Scripts heading in the sidebar.

  6. (Optional) Select the script in the sidebar to view or change its contents.

Copyright     Privacy Policy     Terms of Use     Security
© copyright 2002-2020 Jamf. All rights reserved.