Created
March 28, 2017 13:55
-
-
Save n8felton/baf6391eb046a5fd1efe3d5d7dd8be96 to your computer and use it in GitHub Desktop.
Check if the Mac hardware supports macOS 10.12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ###################### | |
| # Check hardware model | |
| ###################### | |
| hwmodel=$(sysctl -n hw.model) | |
| hwmodel_re='([[:alpha:]]*)([[:digit:]]*),([[:digit:]])' | |
| if [[ $hwmodel =~ $hwmodel_re ]]; then | |
| hwmodel_name="${BASH_REMATCH[1]}" | |
| hwmodel_num="${BASH_REMATCH[2]}" | |
| hwmodel_rev="${BASH_REMATCH[3]}" | |
| fi | |
| # http://www.everymac.com/mac-answers/macos-sierra-faq/macos-sierra-1012-compatible-macs-system-requirements.html | |
| # - iMac10,1 | |
| # - MacBook6,1 | |
| # - MacBookAir3,1 | |
| # - MacBookPro6,1 | |
| # - Macmini4,1 | |
| # - MacPro5,1 | |
| case "${hwmodel_name}" in | |
| iMac) | |
| min_hwmodel_num=10 | |
| ;; | |
| MacBook) | |
| min_hwmodel_num=6 | |
| ;; | |
| MacBookAir) | |
| min_hwmodel_num=3 | |
| ;; | |
| MacBookPro) | |
| min_hwmodel_num=6 | |
| ;; | |
| Macmini) | |
| min_hwmodel_num=4 | |
| ;; | |
| MacPro) | |
| min_hwmodel_num=5 | |
| ;; | |
| VMware) | |
| min_hwmodel_num=7 | |
| ;; | |
| esac | |
| if (( ${hwmodel_num} >= ${min_hwmodel_num} )); then | |
| echo "Model Identifier: ${hwmodel}" | |
| else | |
| echo "This computer does not meet the hardware model requirements for ${os_upgrade_name}. Quitting." | |
| exit 1 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment