From 929e15322d7b71abda3e4d3dcb81ff35c3a6e888 Mon Sep 17 00:00:00 2001 From: Zack T Date: Thu, 27 Sep 2018 11:15:52 -0700 Subject: [PATCH] v1.5 = Updated for Full Mojave Support + Updated for Full Mojave Support + Adjusted the minimum RAM to the actual minimum + Modified the result returned for Sierra to include "OS Limitation" --- .../jamf_ea_LatestOSSupported.sh | 61 ++++++++++++++++--- 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/Jamf Pro/Extension Attributes/jamf_ea_LatestOSSupported.sh b/Jamf Pro/Extension Attributes/jamf_ea_LatestOSSupported.sh index 1c8c026..8d14f6d 100644 --- a/Jamf Pro/Extension Attributes/jamf_ea_LatestOSSupported.sh +++ b/Jamf Pro/Extension Attributes/jamf_ea_LatestOSSupported.sh @@ -3,13 +3,14 @@ ################################################################################################### # Script Name: jamf_ea_LatestOSSupported.sh # By: Zack Thompson / Created: 9/26/2017 -# Version: 1.4.1 / Updated: 8/6/2017 / By: ZT +# Version: 1.5 / Updated: 9/26/2018 / By: ZT # # Description: A Jamf Extension Attribute to check the latest compatible version of macOS. # # System Requirements can be found here: -# Mojave - (https://developer.apple.com/) -# High Sierra - https://support.apple.com/en-us/HT201475 +# Mojave - https://support.apple.com/en-us/HT201475 +# * MacPro5,1's = https://support.apple.com/en-us/HT208898 +# High Sierra - https://support.apple.com/en-us/HT208969 # Sierra - https://support.apple.com/kb/sp742 # El Capitan - https://support.apple.com/kb/sp728 # @@ -19,7 +20,7 @@ # Define Variables # Setting the minimum RAM and free disk space required for compatibility (opting for 4GB instead of 2GB) - minimumRAM=4 + minimumRAM=2 minimumFreeSpace=20 # Transform GB into Bytes convertToGigabytes=$((1024 * 1024 * 1024)) @@ -35,7 +36,7 @@ modelCheck() { elif [[ $modelMajorVersion -ge $2 && $(/usr/bin/bc <<< "${osVersion} >= 8") -eq 1 ]]; then echo "High Sierra" elif [[ $modelMajorVersion -ge $2 && $(/usr/bin/bc <<< "${osVersion} >= 7.5") -eq 1 ]]; then - echo "Sierra" # (Current OS Limitation, 10.13 Compatible) + echo "Sierra / OS Limitation" # (Current OS Limitation, 10.13 Compatible) elif [[ $modelMajorVersion -ge $3 && $(/usr/bin/bc <<< "${osVersion} >= 6.8") -eq 1 ]]; then echo "El Capitan" else @@ -43,6 +44,52 @@ modelCheck() { fi } +# Because Apple had to make Mojave support for MacPro's difficult... I have to add complexity to my simplistic logic in this script. +macProModelCheck() { + # Check if the Graphics Card supports Metal + supportsMetal=$(/usr/sbin/system_profiler SPDisplaysDataType | /usr/bin/awk -F 'Metal: ' '{print $2}' | /usr/bin/xargs) + # Check if FileVault is enabled + fvStatus=$(/usr/bin/fdesetup status | /usr/bin/awk -F 'FileVault is ' '{print $2}' | /usr/bin/xargs) + + macProResult="" + + if [[ $modelMajorVersion -ge $1 && $(/usr/bin/bc <<< "${osVersion} >= 13.6") -eq 1 ]]; then + # Function macProRequirements + macProRequirements + + elif [[ $modelMajorVersion -ge $1 && $(/usr/bin/bc <<< "${osVersion} <= 13.6") -eq 1 ]]; then + macProResult+="High Sierra / OS Limitation," + + # Function macProRequirements + macProRequirements + + macProResult=$(echo "${macProResult}" | /usr/bin/sed "s/,$//") + echo "${macProResult}" + + elif [[ $modelMajorVersion -ge $2 && $(/usr/bin/bc <<< "${osVersion} >= 7.5") -eq 1 ]]; then + echo "Sierra / OS Limitation" # (Current OS Limitation, 10.13 Compatible) + elif [[ $modelMajorVersion -ge $3 && $(/usr/bin/bc <<< "${osVersion} >= 6.8") -eq 1 ]]; then + echo "El Capitan" + else + echo "Model or Current OS Not Supported" + fi +} + +# Check the requirements for Mac Pros +macProRequirements() { + if [[ $supportsMetal != "Supported" ]]; then + macProResult+="GFX unsupported," + fi + + if [[ $fvStatus != "Off." ]]; then + macProResult+="FV Enabled" + fi + + if [[ $macProResult == "" ]]; then + macProResult+="Mojave" + fi +} + ################################################## # Get machine info @@ -50,7 +97,7 @@ modelCheck() { osVersion=$(/usr/bin/sw_vers -productVersion | /usr/bin/awk -F '.' '{print $2"."$3}') # Get the Model Type and Major Version modelType=$(/usr/sbin/sysctl -n hw.model | /usr/bin/sed 's/[^a-zA-Z]//g') - modelMajorVersion=$(/usr/sbin/sysctl -n hw.model | /usr/bin/sed 's/[^0-9,]//g' | /usr/bin/awk -F, '{print $1}') + modelMajorVersion=$(/usr/sbin/sysctl -n hw.model | /usr/bin/sed 's/[^0-9,]//g' | /usr/bin/awk -F ',' '{print $1}') # Get RAM systemRAM=$(/usr/sbin/sysctl -n hw.memsize) # Get free space on the boot disk @@ -85,7 +132,7 @@ if [[ $systemRAM -ge $requiredRAM && $systemFreeSpace -ge $requiredFreeSpace ]]; ;; "MacPro" ) # Function modelCheck - modelCheck 5 5 3 + macProModelCheck 5 5 3 ;; "iMacPro" ) # Function modelCheck