Skip to content

0.9.2: Update Patch_Helper.sh

Choose a tag to compare

@avogel-mac avogel-mac released this 10 Jan 10:50
· 23 commits to main since this release
17fbe8a

Changes:

  • New Variable:
    By adding the new variable $BundleID, the script now checks whether the affected application is running.

    • If the application is not running, it will be immediately executed via:
      /usr/local/bin/jamf policy -id "${PolicyID}" -forceNoRecon
    • If the application is running or $BundleID is empty, it will be added to the JSON and the user will be notified.
  • Background Execution:
    If all applications that need patching are not running, all associated policies run in the background. In this case, no JSON file is created, and the user receives no notification.

    • If the LaunchDaemon was previously loaded for this process, it will be stopped and removed upon completion.
  • Notifications:
    The user will only receive a notification if a patchable application requires user interaction.

Log Entries (example):

2025-01-10 08:35:39 - CHECK-FOR-UPDATES FUNCTION: The total number of updates is: 2
2025-01-10 08:35:39 - CHECK-FOR-UPDATES FUNCTION: Read the values for the LaunchDaemon.
2025-01-10 08:35:39 - CHECK-FOR-UPDATES FUNCTION: The update is carried out every hour.
2025-01-10 08:35:39 - BACKGROUND-UPDATER: The application: Firefox is not executed. The policy with the trigger: 279 is now executed.
2025-01-10 08:35:45 - BACKGROUND-CHECK: Remaining updates that could not be updated in the background: 1
2025-01-10 08:35:45 - BACKGROUND-CHECK: The following number of applications could be updated in the background: 1
2025-01-10 08:35:45 - BACKGROUND-CHECK: The following applications have been updated: Firefox
2025-01-10 08:35:45 - BACKGROUND-CHECK: The following applications could not be updated in the background: Microsoft Word
  • The number of applications that have been updated in the background and their names are recorded in the log.

API Permissions:

  • The “Read Policies” API permission is no longer required.
  • The XML obtained from “Read Computers” is evaluated and written to a plist file. The individual IDs and names are then read from this plist.