Is anyone out there trying to take inventory of which machines in their ecosystems are compatible with High Sierra? I looked around JAMF and Git Hub but I couldn't find anything so I've been trying to write an extension attribute for it but I'm having a heck of a time getting the syntax right for a word list array.
Here is the code I have written so far:
#!/bin/sh
# Author: R.C. Schmittgen
######################################################################
# This script checks for High Seirra Hardware Compatibility.
######################################################################
# This variable defines the model identifier of this particular machine.
Model="sysctl hw.model"
$Model
# This array is the list of compatible macs
CompatibleList=(
"iMac10,1"
"iMac11,1"
"iMac11,3"
"iMac12,1"
"iMac12,2"
"iMac13,1"
"iMac13,2"
"iMac18,2"
"iMac18,3"
"MacBook6,1"
"MacBook7,1"
"MacBook8,1"
"MacBook9,1"
"MacBook10,1"
"MacBookAir3,1"
"MacBookAir3,2"
"MacBookPro6,2"
"MacBookPro6,1"
"MacBookPro8,1"
"MacBookPro8,2"
"MacBookPro8,3"
"MacBookPro9,2"
"MacBookPro9,1"
"MacBookPro11,1"
"MacBookPro11,2"
"MacBookPro11,3"
"MacBookPro12,1"
"MacBookPro11,4"
"MacBookPro11,5"
"MacBookPro13,1"
"Macmini6,2"
"Macmini7,1"
"MacPro5,1"
"iMac14,1"
"iMac14,3"
"iMac14,2"
"iMac14,4"
"iMac15,1"
"iMac16,1"
"iMac16,2"
"iMac17,1"
"iMac18,1"
"MacBookAir4,1"
"MacBookAir4,2"
"MacBookAir5,1"
"MacBookAir5,2"
"MacBookAir6,1"
"MacBookAir6,2"
"MacBookAir7,1"
"MacBookAir7,2"
"MacBookPro7,1"
"MacBookPro10,"
"MacBookPro10,2"
"MacBookPro13,2"
"MacBookPro13,3"
"MacBookPro14,1"
"MacBookPro14,2"
"MacBookPro14,3"
"Macmini4,1"
"Macmini5,1"
"Macmini5,2"
"Macmini5,3"
"Macmini6,1"
"MacPro6,1"
)
# This is so i can test the the array to make sure I can grep out what I need:
for i in ${CompatibleList[*]}
do
echo $i | grep $Model
done
###########################################################################
# This is the program - it checks if the model of the current machine is
# inside the CompatibleList and if so says "yes" if not says "no."
if [ $Model = $CompatibleList | grep "$Model" ];
then
answer="Yes"
else
answer="no"
fi
echo $answer
# This gives the answer to JSS:
<result>$answer</result>
Basically There is a command that is placed into the Variable $Model and then I have list of Macs that are compatible that I'm trying to place into an array. The next piece of code show I can grep out what I need. Then the final bit of code is the actual program that gives me a simple yes or no answer to compatibility that I ca have display in the JSS to create a nice smart group for it.
Does anyone have suggestions on how I can get this array to grep so I can pull the info I need? Or alternatively know where someone has already written this extension attribute so I don't have to? I feel like it has to be out there somewhere.
Thanks!