Hi all,
I know that some of you seem to use the dockutil software. I use it and it works great, but I'm looking to do a few things in the script with groups, but don't script much at all.
Say I've got a basic script, like this one here:
#!/bin/bash
# Enable and configure Dock for Students
LoggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
LoggedInUserHome=`dscl /LDAPv3/127.0.0.1 -read /Users/$LoggedInUser | grep NFSHomeDirectory: | cut -c 19- | head -n 1`
plist=$LoggedInUserHome/Library/Preferences/com.apple.dock.plist
sudo -u $LoggedInUser dockutil --remove all "${plist}"
sudo -u $LoggedInUser dockutil --add /Applications/Google Chrome.app/ "${plist}"
sudo -u $LoggedInUser dockutil --add /Applications/Safari.app/ "${plist}"
sudo -u $LoggedInUser dockutil --add /Applications/Firefox.app/ "${plist}"
sudo -u $LoggedInUser dockutil --add /Applications/Self Service.app/ "${plist}"
sudo -u $LoggedInUser dockutil --add /Applications/Microsoft Office 2008/Microsoft Word.app/ "${plist}"
sudo -u $LoggedInUser dockutil --add /Applications/Microsoft Office 2008/Microsoft Excel.app/ "${plist}"
sudo -u $LoggedInUser dockutil --add /Applications/Microsoft Office 2008/Microsoft PowerPoint.app/ "${plist}"
sudo -u $LoggedInUser dockutil --add /Applications/iWork '09/Pages.app/ "${plist}"
sudo -u $LoggedInUser dockutil --add /Applications/iWork '09/Numbers.app/ "${plist}"
sudo -u $LoggedInUser dockutil --add /Applications/iWork '09/Keynote.app/ "${plist}"
sudo -u $LoggedInUser dockutil --add /Applications/ "${plist}" --section others
sudo -u $LoggedInUser dockutil --add '~/Documents' "${LoggedInUserHome}"
It works out great for students, no problem.
If I wanted to do something like, make a statement that says, I'll give you 2 more application icons if you are a member of GroupX, is there a simple way to do that?
I thought it might be easy to just create 2 scripts: 1 for staff and 1 for students.
Then, I can do, if | else statements, based on what groups they are in. Once it finds their group, it gives them that dock.
The issue is I don't know how to put that together and I'm not sure what happens when they are a member of 2 groups, unless there's some hierarchal way of doing it where I would put groups that would have more icons at the top of the script and it stops processing once it hits that group. That's not a perfect design, but it would work for probably everyone right now.
Any thoughts? Thanks much!
Brian