Posted on 05-02-2018 02:28 PM
I found a great script to update Slack here on Jamf Nation but I couldn't find an extension attribute to find the current installed version so I wrote my own (borrowed from a Google Chrome version EA). My intent is to create a smart group with less than the newest version to scope to the auto-install script. Enjoy!
Slack update script:
Slack OS X app auto-install/update deployment method / script
Slack: Version Installed EA
<?xml version="1.0" encoding="UTF-8"?>
<extensionAttribute>
<displayName>Slack Version</displayName>
<description/>
<dataType>string</dataType>
<scriptContentsMac>#!/bin/sh
#
############################################################################
#
# Extension Attribute checks to display Slack's Version with Release number.
#
# Uses CFBundleShortVersionString because this is the "release version number of the bundle"
# Ref: https://developer.apple.com/library/IOS/#documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
#
#
############################################################################
#
if [ -d /Applications/Slack.app/ ] ; then
RESULT=$( sudo defaults read /Applications/Slack.app/Contents/Info CFBundleShortVersionString )
echo "<result>$RESULT</result>"
else
echo "<result>Not Installed</result>"
fi
</scriptContentsMac>
<scriptContentsWindows/>
</extensionAttribute>
Posted on 05-03-2018 10:02 AM
Is the CFBundleShortVersionString sometimes different than the version number found by making a smart group using Application Version?
Missed that Slack update script though. That's cool.
(also, the html escaped carriage returns "
" in your script are unnecessary I think)
Posted on 05-03-2018 11:01 AM
This is what I did for my slack EA
#!/bin/sh
APP_VERSION_KEY="CFBundleShortVersionString"
currentSlackVersion=$(/usr/bin/curl -s 'https://downloads.slack-edge.com/mac_releases/releases.json' | grep -o "[0-9].[0-9].[0-9]" | tail -1)
localSlackVersion=$(defaults read /Applications/Slack.app/Contents/Info.plist "CFBundleShortVersionString")
if [[ "${currentSlackVersion}" = "${localSlackVersion}" ]]; then
result="updated $localSlackVersion"
else
result="not current"
fi
echo "<result>"$result"</result>"