Posted on 09-05-2016 09:28 PM
Hi all,
I'm new to JAMF and I'm creating my first image from scratch.
I'm wanting to use dockutil to customise the dock at login.
I've placed dockutil in /usr/local/bin/ and I've compiled the following script from others I've seen online:
#!/bin/sh
LoggedInUser=$3
LoggedInUserHome="/Users/$3"
configureDefaultDock() {
echo "Logged in user is $LoggedInUser" echo "Logged in user's home $LoggedInUserHome"
if [ -e /usr/local/bin/dockutil ] ; then dockutilVersion=/usr/local/bin/dockutil --version echo "dockutil version: $dockutilVersion"
echo "Clearing Dock..." /usr/local/bin/dockutil --remove all --no-restart $LoggedInUserHome
echo "Adding Launchpad..." /usr/local/bin/dockutil --add '/Applications/Launchpad.app' --no-restart $LoggedInUserHome
echo "Adding Calendar..." /usr/local/bin/dockutil --add '/Applications/Calendar.app' --no-restart $LoggedInUserHome
echo "Adding Notes..." /usr/local/bin/dockutil --add '/Applications/TextEdit.app' --no-restart $LoggedInUserHome
echo "Adding App Store..." /usr/local/bin/dockutil --add '/Applications/App Store.app' --no-restart $LoggedInUserHome
echo "Adding Google Chrome..." /usr/local/bin/dockutil --add '/Applications/Google Chrome.app' --no-restart $LoggedInUserHome
echo "Adding Slack..." /usr/local/bin/dockutil --add '/Applications/GarageBand.app' --no-restart $LoggedInUserHome
echo "Adding Downloads..." /usr/local/bin/dockutil --add '~/Downloads' --no-restart $LoggedInUserHome
echo "Adding Downloads..." /usr/local/bin/dockutil --add '~/Applications' --no-restart $LoggedInUserHome
touch $LoggedInUserHome/Library/Preferences/com.company.docksetup.plist
else echo "dockutil not installed, skipping initial dock setup..." fi
}
configureDefaultDock
killall -KILL Dock
exit 0
I've created a login policy to run the script, and it runs, but I get the following:
"Executing Policy dockutilA05
Running script dockutilA05.sh...
Script exit code: 2
/Library/Application Support/JAMF/tmp/dockutilA05.sh: line 33: syntax error: unexpected end of file
Error running script: return code was 2."
I'm sure this is simple, so instead of butchering it I thought I'd ask.
Solved! Go to Solution.
Posted on 09-07-2016 04:03 PM
Thanks a lot @franton and @edgardeveij!
I've made those changes and it works a treat.
Here's the script I ended up with:
#!/bin/sh
LoggedInUser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");')
LoggedInUserHome="/Users/$LoggedInUser"
configureDefaultDock() {
echo "Logged in user is $LoggedInUser"
echo "Logged in user's home $LoggedInUserHome"
if [ -e /usr/local/bin/dockutil ];
then
dockutilVersion=`/usr/local/bin/dockutil --version --version`; echo "dockutil version: $dockutilVersion"
echo "Clearing Dock..."; /usr/local/bin/dockutil --remove all --no-restart "$LoggedInUserHome"
echo "Adding Calendar..."; /usr/local/bin/dockutil --add '/Applications/Calendar.app' --no-restart --position 1 "$LoggedInUserHome"
echo "Adding TextEdit..."; /usr/local/bin/dockutil --add '/Applications/TextEdit.app' --no-restart --position 2 "$LoggedInUserHome"
echo "Adding Google Chrome..."; /usr/local/bin/dockutil --add '/Applications/Google Chrome.app' --no-restart --position 3 "$LoggedInUserHome"
echo "Adding GarageBand..."; /usr/local/bin/dockutil --add '/Applications/GarageBand.app' --no-restart --position 4 "$LoggedInUserHome"
echo "Adding GarageBand..."; /usr/local/bin/dockutil --add '/Applications/Sibelius 7.5.app' --no-restart --position 5 "$LoggedInUserHome"
echo "Adding Applications..."; /usr/local/bin/dockutil --add '~/Applications' --no-restart --position 6 "$LoggedInUserHome"
echo "Adding Downloads..."; /usr/local/bin/dockutil --add '~/Downloads' --no-restart --position 7 "$LoggedInUserHome"
touch $LoggedInUserHome/Library/Preferences/com.company.docksetup.plist
else
echo "dockutil not installed, skipping initial dock setup..."
fi
}
configureDefaultDock
killall -KILL Dock
exit 0
To get past dockfixup/SIP I also had to I boot into recovery, disabled SIP in the Terminal, run something like this:
/usr/libexec/PlistBuddy -c "delete:add-app" /System/Library/CoreServices/Dock.app/Contents/Resources/com.apple.dockfixup.plist
/usr/libexec/PlistBuddy -c "delete:add-doc" /System/Library/CoreServices/Dock.app/Contents/Resources/com.apple.dockfixup.plist
Enable SIP and reboot.
Some more info on SIP here:
https://jamfnation.jamfsoftware.com/discussion.html?id=17276
Posted on 09-05-2016 11:23 PM
Decided I'd butcher it, and I ended up with this:
#!/bin/sh
LoggedInUser=$3
LoggedInUserHome="/Users/$3"
configureDefaultDock() {
echo "Logged in user is $LoggedInUser"
echo "Logged in user's home $LoggedInUserHome"
"if" -e /usr/local/bin/dockutil "then" dockutilVersion=/usr/local/bin/dockutil --version
echo "dockutil version: $dockutilVersion"
echo "Clearing Dock..." /usr/local/bin/dockutil --remove all --no-restart "$LoggedInUserHome"
echo "Adding Launchpad..." /usr/local/bin/dockutil --add '/Applications/Launchpad.app' --no-restart --position 1 "$LoggedInUserHome"
echo "Adding Calendar..." /usr/local/bin/dockutil --add '/Applications/Calendar.app' --no-restart --position 2 "$LoggedInUserHome"
echo "Adding TextEdit..." /usr/local/bin/dockutil --add '/Applications/TextEdit.app' --no-restart --position 3 "$LoggedInUserHome"
echo "Adding App Store..." /usr/local/bin/dockutil --add '/Applications/App Store.app' --no-restart --position 4 "$LoggedInUserHome"
echo "Adding Google Chrome..." /usr/local/bin/dockutil --add '/Applications/Google Chrome.app' --no-restart --position 5 "$LoggedInUserHome"
echo "Adding GarageBand..." /usr/local/bin/dockutil --add '/Applications/GarageBand.app' --no-restart --position 6 "$LoggedInUserHome"
echo "Adding Applications..." /usr/local/bin/dockutil --add '$HOME/Applications' --no-restart --position 7 "$LoggedInUserHome"
echo "Adding Downloads..." /usr/local/bin/dockutil --add '$HOME/Downloads' --no-restart --position 8 "$LoggedInUserHome"
touch "$LoggedInUserHome"/Library/Preferences/com.company.docksetup.plist
"else" echo "dockutil not installed, skipping initial dock setup..." "fi"
}
configureDefaultDock
killall -KILL Dock
exit 0
With this result:
Executing Policy dockutilA05 Running script dockutilA05... Script exit code: 0 Script result: Logged in user is localadmin Logged in user's home /Users/localadmin /Library/Application Support/JAMF/tmp/dockutilA05: line 11: if: command not found dockutil version: Clearing Dock... /usr/local/bin/dockutil --remove all --no-restart /Users/localadmin Adding Launchpad... /usr/local/bin/dockutil --add /Applications/Launchpad.app --no-restart --position 1 /Users/localadmin Adding Calendar... /usr/local/bin/dockutil --add /Applications/Calendar.app --no-restart --position 2 /Users/localadmin Adding TextEdit... /usr/local/bin/dockutil --add /Applications/TextEdit.app --no-restart --position 3 /Users/localadmin Adding App Store... /usr/local/bin/dockutil --add /Applications/App Store.app --no-restart --position 4 /Users/localadmin Adding Google Chrome... /usr/local/bin/dockutil --add /Applications/Google Chrome.app --no-restart --position 5 /Users/localadmin Adding GarageBand... /usr/local/bin/dockutil --add /Applications/GarageBand.app --no-restart --position 6 /Users/localadmin Adding Applications... /usr/local/bin/dockutil --add $HOME/Applications --no-restart --position 7 /Users/localadmin Adding Downloads... /usr/local/bin/dockutil --add $HOME/Downloads --no-restart --position 8 /Users/localadmin /Library/Application Support/JAMF/tmp/dockutilA05: line 27: else: command not found
Posted on 09-05-2016 11:36 PM
Yep, don't rely on "$3". You should try something like this instead.
LoggedInUser=`python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");'`
LoggedInUserHome="/Users/$LoggedInUser"
Posted on 09-06-2016 12:39 AM
@franton I'll try using that in the morning, thank you.
Posted on 09-06-2016 03:04 PM
Gave that a try @franton, same thing:
Executing Policy dockutilA05 Running script dockutilA05... Script exit code: 0 Script result: Logged in user is localadmin Logged in user's home /Users/localadmin /Library/Application Support/JAMF/tmp/dockutilA05: line 11: if: command not found dockutil version: Clearing Dock... /usr/local/bin/dockutil --remove all --no-restart /Users/localadmin Adding Launchpad... /usr/local/bin/dockutil --add /Applications/Launchpad.app --no-restart --position 1 /Users/localadmin Adding Calendar... /usr/local/bin/dockutil --add /Applications/Calendar.app --no-restart --position 2 /Users/localadmin Adding TextEdit... /usr/local/bin/dockutil --add /Applications/TextEdit.app --no-restart --position 3 /Users/localadmin Adding App Store... /usr/local/bin/dockutil --add /Applications/App Store.app --no-restart --position 4 /Users/localadmin Adding Google Chrome... /usr/local/bin/dockutil --add /Applications/Google Chrome.app --no-restart --position 5 /Users/localadmin Adding GarageBand... /usr/local/bin/dockutil --add /Applications/GarageBand.app --no-restart --position 6 /Users/localadmin Adding Applications... /usr/local/bin/dockutil --add ~/Applications --no-restart --position 7 /Users/localadmin Adding Downloads... /usr/local/bin/dockutil --add ~/Downloads --no-restart --position 8 /Users/localadmin /Library/Application Support/JAMF/tmp/dockutilA05: line 27: else: command not found
Posted on 09-06-2016 04:59 PM
Just gave the following a go:
LoggedInUser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");')
LoggedInUserHome="/Users/$LoggedInUser"
Ended up with:
Executing Policy dockutilA05 Running script dockutilA05... Script exit code: 0 Script result: Logged in user is localadmin Logged in user's home /Users/localadmin /Library/Application Support/JAMF/tmp/dockutilA05: line 11: if: command not found dockutil version: Clearing Dock... /usr/local/bin/dockutil --remove all --no-restart /Users/localadmin Adding Launchpad... /usr/local/bin/dockutil --add /Applications/Launchpad.app --no-restart --position 1 /Users/localadmin Adding Calendar... /usr/local/bin/dockutil --add /Applications/Calendar.app --no-restart --position 2 /Users/localadmin Adding TextEdit... /usr/local/bin/dockutil --add /Applications/TextEdit.app --no-restart --position 3 /Users/localadmin Adding App Store... /usr/local/bin/dockutil --add /Applications/App Store.app --no-restart --position 4 /Users/localadmin Adding Google Chrome... /usr/local/bin/dockutil --add /Applications/Google Chrome.app --no-restart --position 5 /Users/localadmin Adding GarageBand... /usr/local/bin/dockutil --add /Applications/GarageBand.app --no-restart --position 6 /Users/localadmin Adding Applications... /usr/local/bin/dockutil --add ~/Applications --no-restart --position 7 /Users/localadmin Adding Downloads... /usr/local/bin/dockutil --add ~/Downloads --no-restart --position 8 /Users/localadmin /Library/Application Support/JAMF/tmp/dockutilA05: line 27: else: command not found
Posted on 09-07-2016 12:22 AM
Your bash if construction needs work. You currently have:
if [ -e /usr/local/bin/dockutil ] ; then dockutilVersion=/usr/local/bin/dockutil --version echo "dockutil version: $dockutilVersion"
dock stuff here
else echo "dockutil not installed, skipping initial dock setup..." fi
You should think of it more like:
if [ -e /usr/local/bin/dockutil ];
then
dockutilVersion=/usr/local/bin/dockutil --version echo "dockutil version: $dockutilVersion"
dock stuff here
else
echo "dockutil not installed, skipping initial dock setup..."
fi
The amalgamation of lines can cause issues as the error now looks like it's trying to execute a command on the local path, that simply isn't there.
Posted on 09-07-2016 08:42 AM
Also:
dockutilVersion=/usr/local/bin/dockutil --version
won't work. It's missing backticks
dockutilVersion=`/usr/local/bin/dockutil --version`
and the lines like:
echo "Adding Launchpad..." /usr/local/bin/dockutil --add '/Applications/Launchpad.app' --no-restart --position 1 "$LoggedInUserHome"
are missing semicolons between the echo and dockutil commands:
echo "Adding Launchpad..."; /usr/local/bin/dockutil --add '/Applications/Launchpad.app' --no-restart --position 1 "$LoggedInUserHome"
edit:
reviewing my post: somehow backticks disappeared in message.
Posted on 09-07-2016 04:03 PM
Thanks a lot @franton and @edgardeveij!
I've made those changes and it works a treat.
Here's the script I ended up with:
#!/bin/sh
LoggedInUser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");')
LoggedInUserHome="/Users/$LoggedInUser"
configureDefaultDock() {
echo "Logged in user is $LoggedInUser"
echo "Logged in user's home $LoggedInUserHome"
if [ -e /usr/local/bin/dockutil ];
then
dockutilVersion=`/usr/local/bin/dockutil --version --version`; echo "dockutil version: $dockutilVersion"
echo "Clearing Dock..."; /usr/local/bin/dockutil --remove all --no-restart "$LoggedInUserHome"
echo "Adding Calendar..."; /usr/local/bin/dockutil --add '/Applications/Calendar.app' --no-restart --position 1 "$LoggedInUserHome"
echo "Adding TextEdit..."; /usr/local/bin/dockutil --add '/Applications/TextEdit.app' --no-restart --position 2 "$LoggedInUserHome"
echo "Adding Google Chrome..."; /usr/local/bin/dockutil --add '/Applications/Google Chrome.app' --no-restart --position 3 "$LoggedInUserHome"
echo "Adding GarageBand..."; /usr/local/bin/dockutil --add '/Applications/GarageBand.app' --no-restart --position 4 "$LoggedInUserHome"
echo "Adding GarageBand..."; /usr/local/bin/dockutil --add '/Applications/Sibelius 7.5.app' --no-restart --position 5 "$LoggedInUserHome"
echo "Adding Applications..."; /usr/local/bin/dockutil --add '~/Applications' --no-restart --position 6 "$LoggedInUserHome"
echo "Adding Downloads..."; /usr/local/bin/dockutil --add '~/Downloads' --no-restart --position 7 "$LoggedInUserHome"
touch $LoggedInUserHome/Library/Preferences/com.company.docksetup.plist
else
echo "dockutil not installed, skipping initial dock setup..."
fi
}
configureDefaultDock
killall -KILL Dock
exit 0
To get past dockfixup/SIP I also had to I boot into recovery, disabled SIP in the Terminal, run something like this:
/usr/libexec/PlistBuddy -c "delete:add-app" /System/Library/CoreServices/Dock.app/Contents/Resources/com.apple.dockfixup.plist
/usr/libexec/PlistBuddy -c "delete:add-doc" /System/Library/CoreServices/Dock.app/Contents/Resources/com.apple.dockfixup.plist
Enable SIP and reboot.
Some more info on SIP here:
https://jamfnation.jamfsoftware.com/discussion.html?id=17276
Posted on 09-08-2016 02:05 PM
Great script @McKinnonTech
I "borrowed" it today for a lab. Using outset I did not have to disable SIP
L
Posted on 09-08-2016 03:41 PM
My version which was built on a basic script from @colin.
This one adds icons based on our dummy receipt (cohort). It also doesn't mess with the dockfixup.plist, it just clears the dock.
https://github.com/jmahlman/uarts-scripts/blob/master/dockMaster.sh
#!/bin/sh
#
########################################################################
# Original created By: Colin Bohn, Stanwood-Camano School District (cbohn@scsd.ac)
#
# Customized by John Mahlman, University of the Arts Philadelphia
# Last Updated July 19, 2016
#
# Name: DockMaster
# Purpose: Set the contents of the dock on login based on computer type (cohort)
# and what applications are available on the local machine.
########################################################################
sleep 5 # we need to wait for the dock to actually start
#######################################
#### Where's our JAMF binary?
#######################################
jamfbinary=$(/usr/bin/which jamf)
#######################################
##### Lets make sure we have DockUtil
#######################################
if [ ! -f "/usr/local/bin/dockutil" ]; then
echo "Installing DockUtil from JSS"
"$jamfbinary" policy -event dockutil
if [ ! -f "/usr/local/bin/dockutil" ]; then
echo "Unable to install DockUtil, aborting!"
exit 1
fi
fi
du="/usr/local/bin/dockutil"
#######################################
##### Find out who we are modifying
#######################################
if [ ! -n "$3" ]; then
user=$3
else
user=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");')
fi
echo "Running DockMaster on $user"
#######################################
##### Let's find that cohort...
#######################################
if [ -f /Library/JAMF DM/Cohort/*.txt ]; then
cohort=$(cat /Library/JAMF DM/Cohort/*.txt)
echo "Cohort set to $cohort"
else
echo "No cohort available! Adding default icons cohort"
cohort="NONE"
fi
#######################################
#### Bundled Apps Checker Functions
#######################################
officeIcons ()
{
wordversion=$(defaults read "/Applications/Microsoft Word.app/Contents/Info.plist" CFBundleShortVersionString)
# Checking for Office 2016
sleep 2
if [[ $wordversion == "15."* ]]; then
echo "Adding Office 2016 apps"
$du --add "/Applications/Microsoft Word.app" --no-restart /Users/$user
$du --add "/Applications/Microsoft Excel.app" --no-restart /Users/$user
$du --add "/Applications/Microsoft Outlook.app" --no-restart /Users/$user
$du --add "/Applications/Microsoft Powerpoint.app" --no-restart /Users/$user
else
# Checking for Office 2011
if [ -d "/Applications/Microsoft Office 2011/" ]; then
echo "Adding Office 2011 apps"
$du --add "/Applications/Microsoft Office 2011/Microsoft Word.app" --no-restart /Users/$user
$du --add "/Applications/Microsoft Office 2011/Microsoft Excel.app" --no-restart /Users/$user
$du --add "/Applications/Microsoft Office 2011/Microsoft Outlook.app" --no-restart /Users/$user
$du --add "/Applications/Microsoft Office 2011/Microsoft Powerpoint.app" --no-restart /Users/$user
fi
fi
}
iWorkIcons ()
{
echo "Adding installed iWork Apps"
if [ -e "/Applications/Pages.app" ]; then
$du --add "/Applications/Pages.app" --no-restart /Users/$user
fi
if [ -e "/Applications/Numbers.app" ]; then
$du --add "/Applications/Numbers.app" --no-restart /Users/$user
fi
if [ -e "/Applications/Keynote.app" ]; then
$du --add "/Applications/Keynote.app" --no-restart /Users/$user
fi
}
#######################################
#### Get a clean slate going here
#######################################
echo "Removing all items from the dock"
$du --remove all --no-restart /Users/$user
sleep 2 # we need to give this time to work or we'll get errors with "replacing" items instead of adding them.
#######################################
#### Items for all/no cohorts
#######################################
echo "Adding browsers"
$du --add "/Applications/Safari.app" --no-restart /Users/$user
if [ -e "/Applications/Google Chrome.app/" ]; then
$du --add "/Applications/Google Chrome.app" --no-restart /Users/$user
fi
# We have two different firefox types, lets figure out which one is installed
if [ -e /Applications/Firefox* ]; then
firefox=$(find /Applications -type d -maxdepth 1 -name Firefox*)
$du --add "$firefox" --no-restart /Users/$user
fi
# Add Office icons to all cohorts
officeIcons
# Every user gets a downloads folder too
echo "Adding the Downloads folder"
$du --add "~/Downloads" --view fan --display stack --sort dateadded --no-restart /Users/$user
#######################################
#### Add dock items for FACSTAFF cohort
#######################################
if [ $cohort == "FACSTAFF" ]; then
echo "Adding apps for FACSTAFF"
$du --add "/Applications/Calendar.app" --no-restart /Users/$user
$du --add "/Applications/Preview.app" --no-restart /Users/$user
$du --add "/Applications/iTunes.app" --no-restart /Users/$user
$du --add "/Applications/Photo Booth.app" --no-restart /Users/$user
$du --add "/Applications/Time Machine.app" --no-restart /Users/$user
if [ -e "/Library/KeyAccess/KeyCheckout.app/" ]; then
$du --add "/Library/KeyAccess/KeyCheckout.app" --no-restart /Users/$user
fi
if [ -e "/Applications/Network Connect.app/" ]; then
$du --add "/Applications/Network Connect.app" --no-restart /Users/$user
fi
$du --add "/Applications/Self Service.app" --no-restart /Users/$user
$du --add "/Applications/App Store.app" --no-restart /Users/$user
$du --add "/Applications/System Preferences.app" --position end --no-restart /Users/$user
# This should be the end of the applications in the dock, anything after should be a folder
$du --add "/Applications" --view grid --display folder --sort name --no-restart /Users/$user
$du --add "~/Documents" --view fan --display stack --sort dateadded --no-restart /Users/$user
#######################################
#### Add dock items for OFFICE cohort
#######################################
elif [ $cohort == "OFFICE" ]; then
echo "Adding apps for OFFICE cohort"
$du --add "/Applications/Launchpad.app" --position beginning --no-restart /Users/$user
$du --add "/Applications/Contacts.app" --no-restart /Users/$user
$du --add "/Applications/Calendar.app" --no-restart /Users/$user
$du --add "/Applications/Notes.app" --no-restart /Users/$user
$du --add "/Applications/Messages.app" --no-restart /Users/$user
$du --add "/Applications/Self Service.app" --no-restart /Users/$user
$du --add "/Applications/System Preferences.app" --position end --no-restart /Users/$user
# This should be the end of the applications in the dock, anything after should be a folder
$du --add "/Applications" --view grid --display folder --sort name --no-restart /Users/$user
#######################################
#### Add dock items for PUBLIC cohorts
#### This one has a lot of different cohorts,
#### You can break it down as much as you want
#######################################
elif [ $cohort == "LAB" ] || [ $cohort == "STUDIO" ] || [ $cohort == "SUITE" ] || [ $cohort == "SMART-CLASSROOM" ]; then
echo "Adding apps for $cohort cohort"
iWorkIcons
$du --add "/Applications/Image Capture.app" --no-restart /Users/$user
$du --add "/Applications/Preview.app" --no-restart /Users/$user
# This should be the end of the applications in the dock, anything after should be a folder
$du --add "/Applications" --view grid --display folder --sort name --no-restart /Users/$user
#######################################
#### Add dock items for CHECKOUT cohort
#######################################
elif [ $cohort == "CHECKOUT" ]; then
echo "Adding apps for CHECKOUT cohort"
$du --add "/Applications/Calendar.app" --no-restart /Users/$user
$du --add "/Applications/Preview.app" --no-restart /Users/$user
$du --add "/Applications/iTunes.app" --no-restart /Users/$user
$du --add "/Applications/Photo Booth.app" --no-restart /Users/$user
$du --add "/Applications/Time Machine.app" --no-restart /Users/$user
if [ -e "/Library/KeyAccess/KeyCheckout.app/" ]; then
$du --add "/Library/KeyAccess/KeyCheckout.app" --no-restart /Users/$user
fi
if [ -e "/Applications/Network Connect.app/" ]; then
$du --add "/Applications/Network Connect.app" --no-restart /Users/$user
fi
$du --add "/Applications/Self Service.app" --no-restart /Users/$user
$du --add "/Applications/App Store.app" --no-restart /Users/$user
$du --add "/Applications/System Preferences.app" --position end --no-restart /Users/$user
# This should be the end of the applications in the dock, anything after should be a folder
$du --add "/Applications" --view grid --display folder --sort name --no-restart /Users/$user
$du --add "~/Documents" --view fan --display stack --sort dateadded --no-restart /Users/$user
#######################################
#### Add dock items for KIOSK cohort
#######################################
elif [ $cohort == "KIOSK" ]; then
echo "Adding apps for KIOSK cohort"
fi #end of cohorts
# Restart the dock after everything is done
sleep 5
killall Dock
exit 0