mercredi 25 février 2015

Determine and Use Resolution as a Variable in UNIX script on Mac


I'm deploying a NetRestore image to multiple kinds of Macs: MacBooks, MacBook Pros, Mac Pros, iMacs and Mac Minis. I have several custom designed login screens that I'd like to use but everything before 10.10 requires that you know the monitor resolution otherwise the login background won't show correctly.


Is there a way to use the output of this code as a variable for a series of IF/THEN statements?



system_profiler SPDisplaysDataType |grep Resolution


The normal output shows like this



Resolution: 2560 x 1440
Resolution: 1920 x 1200
Resolution: 1920 x 1200


(This is if you have three monitors...I'd prefer to use the first result).


My intention is for the script to run when binding the Mac to Active Directory (which has to be done manually), so the resolution should already be available. It would select the correct resolution image and then copy it into the required location.


Or by chance does anyone have any good idea on how to create custom login window backgrounds and user backgrounds to work on any type of Mac with any resolution? (Just like the OS does when you select "Fit to Screen" in System Preferences)


Thanks!





Aucun commentaire:

Enregistrer un commentaire