Update Spitfire Audio.munki.recipe
<string>Spitfire Audio</string>
<key>name</key>
<string>%NAME%</string>
+ <key>postinstall_script</key>
+ <string>#!/bin/bash
+#
+# Copyright (c) 2020, dataJAR Ltd. All rights reserved.
+#
+
+helperName="com.spitfireaudio.LibraryManagerHelper"
+daemonPath="/Library/LaunchDaemons/${helperName}.plist"
+
+if [ ! -f /Library/PrivilegedHelperTools/"${helperName}" ]
+then
+ /bin/echo "Copying Privileged Helper from /Applications/Spitfire Audio.app/Contents/Library/LaunchServices/${helperName} to /Library/PrivilegedHelperTools/..."
+ /bin/cp '/Applications/Spitfire Audio.app/Contents/Library/LaunchServices/com.spitfireaudio.LibraryManagerHelper' /Library/PrivilegedHelperTools/
+fi
+
+if [ ! -f "${daemonPath}" ]
+then
+ /bin/echo "LaunchDaemon missing, writing out..."
+ /usr/bin/defaults write "${daemonPath}" KeepAlive -bool true
+ /usr/bin/defaults write "${daemonPath}" Label com.spitfireaudio.LibraryManagerHelper
+ /usr/bin/defaults write "${daemonPath}" MachServices -dict-add com.spitfireaudio.LibraryManagerHelper -bool true
+ /usr/bin/defaults write "${daemonPath}" Program /Library/PrivilegedHelperTools/com.spitfireaudio.LibraryManagerHelper
+ /usr/bin/defaults write "${daemonPath}" ProgramArguments -array-add /Library/PrivilegedHelperTools/com.spitfireaudio.LibraryManagerHelper
+ /bin/echo "Setting LaunchDaemon permissions..."
+ /usr/sbin/chown root:wheel "${daemonPath}"
+ /bin/chmod 755 "${daemonPath}"
+ /bin/echo "Loading LaunchDaemon..."
+ /usr/sbin/chown root:wheel "${daemonPath}"
+ /bin/chmod 755 "${daemonPath}"
+ /bin/launchctl load -w "${daemonPath}"
+fi</string>
<key>unattended_install</key>
<true/>
+ <key>unattended_uninstall</key>
+ <true/>
+ <key>uninstall_method</key>
+ <string>uninstall_script</string>
+ <key>uninstall_script</key>
+ <string>#!/bin/bash
+#
+# Copyright (c) 2020, dataJAR Ltd. All rights reserved.
+#
+
+helperName="com.spitfireaudio.LibraryManagerHelper"
+daemonPath="/Library/LaunchDaemons/${helperName}.plist"
+appPath="/Applications/Spitfire Audio.app"
+
+if [ -f /Library/PrivilegedHelperTools/"${helperName}" ]
+then
+ /bin/echo "Deleting Privileged Helper ${helperName} from ${helperName} to /Library/PrivilegedHelperTools/..."
+ /bin/rm -rf /Library/PrivilegedHelperTools/"${helperName}"
+fi
+
+if [ -f "${daemonPath}" ]
+then
+ /bin/echo "Unloading LaunchDaemon..."
+ /bin/launchctl unload -w "${daemonPath}"
+ /bin/echo "Deleting LaunchDaemon..."
+ //bin/rm "${daemonPath}"
+fi
+
+if [ -d "${appPath}" ]
+then
+ /bin/echo "Deleting ${appPath}..."
+ /bin/rm -rf "${appPath}"
+fi</string>
</dict>
</dict>
<key>MinimumVersion</key>
