Script to determine slack app architecture

JamfAdmin2
New Contributor II

hello is there a script out there already or how can i create a script that can 

 

determine the Slack app architecture whether the user is using a  - (intel, silicon, universal)? version of slack

9 REPLIES 9

Mauricio
Contributor III

Hello, 

A quick script using lipo 


#!/bin/bash
if [[ -e /Applications/Slack.app ]]; then
appArch=$(lipo /Applications/Slack.app/Contents/MacOS/Slack -archs)
case "$appArch" in 
    "x86_64 arm64" ) echo "Universal App"  ;;
    "x86_64" ) echo "Intel App"  ;;
    "arm64" ) echo "Silicon App"  ;;
esac
fi

 

JamfAdmin2
New Contributor II

hello thank you so much for this script i really appreciate if you can please help me with this script question i wanted to know how can we update that script so it would work as a Jamf extension?

Hello, 

Once you are happy with your script outcome, go to Jamf Pro /Settings/Computer management/Extension attributes

Create a New EA
Give a Display Name
Data Type: String
Choose where to Inventory Display
Input Type select Script.
Copy and Paste the script and let the Macs update the info after the inventory update.

 

Now the script needs some key data to be sent to Jamf Pro. This is how.

echo "<result>some info</result>"

So the script above should be:

#!/bin/bash
if [[ -e /Applications/Slack.app ]]; then
appArch=$(lipo /Applications/Slack.app/Contents/MacOS/Slack -archs)
case "$appArch" in 
    "x86_64 arm64" ) echo "<result>Universal App</result>" ;;
    "x86_64" ) echo "<result>Intel App</result>" ;;
    "arm64" ) echo "<result>Silicon App</result>" ;;
esac
else
# if not installed, so you know the EA has run
echo "<result>N/A</result>"
fi
exit 0

I hope this helps.

Regards

Mauricio

 

JamfAdmin2
New Contributor II

i appreciate the help on this i really do i just wanted to know is it possible to tweak the script or have it work without using the “lipo” command ? 

Using the previous recommendation of file command, grep the text of the binary and report 1 if matches and 0 is not. Bit more basic but should do the job.

#!/bin/bash
if [[ -e /Applications/Slack.app ]]; then
# using file and getting the number of entry for the text "Mach-O universal binary with 2 architectures" 
appUniversal=$(file /Applications/Slack.app/Contents/MacOS/Slack | grep -c "Mach-O universal binary with 2 architectures")
case "$appUniversal" in 
    "1" ) echo "<result>Universal App</result>" ;;
    "0" ) echo "<result>Not Universal App</result>" ;;
esac
else
# if not installed, so you know the EA has run
echo "<result>N/A</result>"
fi
exit 0

  

JamfAdmin2
New Contributor II

is there a command on the mac terminal that can tell me if slack is using universal, intel, or silicon?

file /path/to/binary | awk -F':\ ' '{print $2}'

JamfAdmin2
New Contributor II

does not work

JamfAdmin2_0-1692911579179.png

 

It should've been the actual path to the binary file in question, with the path single- or double-quoted if needed. The one I provided was a placeholder for the purpose of presentation 😶