-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathBigSur-Compatibility-Checker.sh
147 lines (132 loc) · 7.81 KB
/
BigSur-Compatibility-Checker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Copyright (c) 2020 Jamf. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Jamf nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# This script is published here:
# https://github.com/laurentpertois/BigSur-Compatibility-Checker
#
# Other scripts and resources available here:
# https://github.com/laurentpertois?tab=repositories
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# This script was designed to be used as an Extension Attribute to ensure specific
# requirements have been met to deploy macOS Big Sur.
#
# General Requirements:
# - OS X 10.9.0 or later (It seems, as of the day I write this Apple has not yet made recommendations, this page and the script will be adapted if necessary when the information will become public)
# - 4GB of memory (It seems, as of the day I write this Apple has not yet made recommendations, this page and the script will be adapted if necessary when the information will become public)
# - 20GB of available storage (It seems, as of the day I write this Apple has not yet made recommendations, this page and the script will be adapted if necessary when the information will become public)
#
#
# These last 2 requirements can be modified in the first 2 variables (MINIMUMRAM
# and MINIMUMSPACE).
# - REQUIREDMINIMUMRAM: minimum RAM required, in GB
# - REQUIREDMINIMUMSPACE: minimum disk space available, in GB. Big Sur has different
# requirements depending on the OS from which you update
# Adjust to your needs, lines 79 (Catalina) or 82 (pre-Catalina)
#
#
# Mac Hardware Requirements and equivalent as minimum Model Identifier
# - MacBook (Early 2015 or newer), ie MacBook8,1
# - MacBook Pro (Late 2013 or newer), ie MacBookPro11,1
# - MacBook Air (Mid 2013 or newer), ie MacBookAir6,1
# - Mac mini (Late 2014 or newer), ie Macmini7,1
# - iMac (Mid 2014 or newer), ie iMac14,4
# - iMac Pro, ie iMacPro1,1
# - Mac Pro (Late 2013 or newer), ie MacPro6,1
#
#
# Default compatibility is set to False if no test pass (variable COMPATIBILITY)
#
# Written by: Laurent Pertois | Senior Professional Services Engineer | Jamf
#
# Created On: 2020-07-23
# Modified On: 2020-11-13 to adjust required disk space
# Modified On: 2021-01-19 to fix an issue with MacBook Pro models (basically they were all true)
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Checks minimum version of the OS before upgrade (10.9.0)
OSVERSIONMAJOR=$(sw_vers -buildVersion | cut -c 1-2)
# Minimum RAM and Disk Space required (4GB and 45GB default. Note that REQUIREDMINIMUMSPACE must be set to an integer)
# According to https://support.apple.com/en-us/HT211238 the minimum space requirement for Big Sur is 35.5GB if you're coming from Sierra, it can go up to 44.5GB if coming from an older version
# This value is acconting for the required space and the size of the installer (almost 13GB)
REQUIREDMINIMUMRAM=4
if [[ "$OSVERSIONMAJOR" -ge 16 ]]; then
# For Sierra and higher required space is 12.3GB for the installer and 35.5GB for required disk space for installation which equals to 47.8GB, 50GB is giving a bit of extra free space for safety
REQUIREDMINIMUMSPACE=50
else
# For pre-Sierra required space is 12.3GB for the installer and 44.5GB for required disk space for installation which equals to 56.8GB, 60GB is giving a bit of extra free space for safety
REQUIREDMINIMUMSPACE=60
fi
#########################################################################################
############### DO NOT CHANGE UNLESS NEEDED
#########################################################################################
# Default values for Compatibility is false
COMPATIBILITY="False"
#########################################################################################
############### Let's go!
#########################################################################################
# Checks if computer meets pre-requisites for Big Sur
if [[ "$OSVERSIONMAJOR" -ge 13 && "$OSVERSIONMAJOR" -le 19 ]]; then
# Transform GB into Bytes
GIGABYTES=$((1024 * 1024 * 1024))
MINIMUMRAM=$(($REQUIREDMINIMUMRAM * $GIGABYTES))
MINIMUMSPACE=$(($REQUIREDMINIMUMSPACE * $GIGABYTES))
# Gets the Model Identifier, splits name and major version
MODELIDENTIFIER=$(/usr/sbin/sysctl -n hw.model)
MODELNAME=$(echo "$MODELIDENTIFIER" | sed 's/[^a-zA-Z]//g')
MODELVERSION=$(echo "$MODELIDENTIFIER" | sed -e 's/[^0-9,]//g' -e 's/,//')
# Gets amount of memory installed
MEMORYINSTALLED=$(/usr/sbin/sysctl -n hw.memsize)
# Gets free space on the boot drive
FREESPACE=$(diskutil info / | awk -F '[()]' '/Free Space|Available Space/ {print $2}' | sed -e 's/\ Bytes//')
# Checks if computer meets pre-requisites for Big Sur
if [[ "$MODELNAME" == "iMac" && "$MODELVERSION" -ge 144 && "$MEMORYINSTALLED" -ge "$MINIMUMRAM" && "$FREESPACE" -ge "$MINIMUMSPACE" ]]; then
COMPATIBILITY="True"
elif [[ "$MODELNAME" == "iMacPro" && "$MODELVERSION" -ge 10 && "$MEMORYINSTALLED" -ge "$MINIMUMRAM" && "$FREESPACE" -ge "$MINIMUMSPACE" ]]; then
COMPATIBILITY="True"
elif [[ "$MODELNAME" == "Macmini" && "$MODELVERSION" -ge 70 && "$MEMORYINSTALLED" -ge "$MINIMUMRAM" && "$FREESPACE" -ge "$MINIMUMSPACE" ]]; then
COMPATIBILITY="True"
elif [[ "$MODELNAME" == "MacPro" && "$MODELVERSION" -ge 60 && "$MEMORYINSTALLED" -ge "$MINIMUMRAM" && "$FREESPACE" -ge "$MINIMUMSPACE" ]]; then
COMPATIBILITY="True"
elif [[ "$MODELNAME" == "MacBook" && "$MODELVERSION" -ge 80 && "$MEMORYINSTALLED" -ge "$MINIMUMRAM" && "$FREESPACE" -ge "$MINIMUMSPACE" ]]; then
COMPATIBILITY="True"
elif [[ "$MODELNAME" == "MacBookAir" && "$MODELVERSION" -ge 60 && "$MEMORYINSTALLED" -ge "$MINIMUMRAM" && "$FREESPACE" -ge "$MINIMUMSPACE" ]]; then
COMPATIBILITY="True"
elif [[ "$MODELNAME" == "MacBookPro" && "$MODELVERSION" -ge 110 && "$MEMORYINSTALLED" -ge "$MINIMUMRAM" && "$FREESPACE" -ge "$MINIMUMSPACE" ]]; then
COMPATIBILITY="True"
fi
# Outputs result
echo "<result>$COMPATIBILITY</result>"
else
echo "<result>$COMPATIBILITY</result>"
exit $?
fi