There is no urgency for this. What I am trying to do is learn how to create a script to do one-off application updates using a policy instead of using Patch Management. The idea is to include a set of parameters that a Jamf tech can fill in to specify which app we are updating with the policy that the script is attached to. The script below works, but there's just one issue. I'm using an osascript to display the dialog to alert the user that the app is about to be updated. The dialog appears, but it does not show the name of the app we are updating. Instead it shows the name of the parameter. Does osascript not work with parameters, or am I just doing something wrong? I don't want the update to run until the user has quit the app and clicked OK. Here's a screenshot of the dialog that appears. My script is below. Thanks for the help!
#!/bin/sh
#Updates application at the path defined in paramater 7 to the version defined in parameter 4. For parameter 5, fill in the full application name to be displayed to the user when the policy runs. Policy trigger for parameter 6 can be found in the Installers and Configs category in Policies.
#Parameter for new software version
newVersion="$4"
appName="$5"
policyTrigger="$6"
appPath="$7"
#What is the version of the app installed? Update the app if not current.
version=$(defaults read $appPath/Info CFBundleShortVersionString)
echo $version
if [[ $version > $newVersion ]]
then echo "Application is not current"
else /usr/bin/osascript -e 'display dialog "$appName is not current. Quit $appName, then click OK to update." buttons {"OK"} default button 1'; jamf policy -event $policyTrigger
fi
#Created by Howie Isaacks | F1 Information Technologies | 08/06/2021