Posted on 07-28-2014 11:16 AM
I've used dockutil outside of Casper for ages now it seems. But our group is moving towards Casper and I'm working on rebuilding our image with the Casper workflow.
I'm using dockutil 2.0, and I've tested my shell script manually. Everything seems to work fine for the most part.
I've added the script to our casper server (using afp if that might be a question to come up). But the script doesn't seem to work either when the script is part of the imaging process (tried 'at restart' and 'after'), or through Self Service. I could try pushing it with a policy, but I don't see how that would work any better at this point.
There's nothing in /var/logs/jamf.log about the script after imaging.
Is there something I'm missing?
#!/bin/bash
sudo dockutil --remove 'Launchpad' --allhomes
sudo dockutil --remove 'Mail' --allhomes
sudo dockutil --remove 'Contacts' --allhomes
sudo dockutil --remove 'Calendar' --allhomes
sudo dockutil --remove 'Notes' --allhomes
sudo dockutil --remove 'Maps' --allhomes
sudo dockutil --remove 'FaceTime' --allhomes
sudo dockutil --remove 'Photo Booth' --allhomes
sudo dockutil --remove 'iPhoto' --allhomes
sudo dockutil --remove 'Pages' --allhomes
sudo dockutil --remove 'Numbers' --allhomes
sudo dockutil --remove 'Keynote' --allhomes
sudo dockutil --remove 'iBooks' --allhomes
sudo dockutil --add /Applications/Firefox.app --after 'Safari' --allhomes
sudo dockutil --add /Applications/Google Chrome.app --after 'Firefox' --allhomes
sudo dockutil --add /Applications/Final Cut Pro.app --after 'Google Chrome' --allhomes
sudo dockutil --add /Applications/Adobe Photoshop CC 2014/Adobe Photoshop CC 2014.app --after 'Final Cut Pro' --allhomes
sudo dockutil --add /Applications/Cyberduck.app --after 'Adobe Photoshop CC 2014' --allhomes
sudo dockutil --add /Applications/Filezilla.app --after 'Cyberduck' --allhomes
sudo dockutil --add /Applications/Microsoft Office 2011/Microsoft Word.app --before 'iTunes' --allhomes
sudo dockutil --add /Applications/Microsoft Office 2011/Microsoft Excel.app --before 'iTunes' --allhomes
sudo dockutil --add /Applications/Microsoft Office 2011/Microsoft Powerpoint.app --before 'iTunes' --allhomes
sudo dockutil --add /Applications/Microsoft Office 2011/Microsoft Outlook.app --before 'iTunes' --allhomes
sudo dockutil --add /Applications/Skype.app --before 'iTunes'--allhomes
sudo dockutil --remove 'Downloads' --allhomes
sudo dockutil --add '~/Downloads' --view list --display folder --allhomes
Posted on 07-28-2014 11:42 AM
You might try setting up logging so that you can see what the particular bits are doing. Running this as a Self Service script and adding something like this to the top:
LOGPATH='/private/var/inte/logs'
if [[ ! -d "$LOGPATH" ]]; then
mkdir $LOGPATH
fi
set -xv; exec 1> $LOGPATH/<yourlogfilename>.txt 2>&1
That will log all commands to that file, then you can go back through and see what's going on.
Also, you don't need to use 'sudo' on each line. Since the script is run by Casper it is being run in the context of the root user.
Posted on 07-29-2014 05:47 AM
More than likely this isn't working because the script is being run as root and is trying to populate the root account dock - which won't exist. Create a policy to run the script on login and append each command with "sudo -u $3" and you should be good to go.
e.g
sudo -u $3 /usr/sbin/dockutil --add /Applications/Firefox.app --after 'Safari' --allhomes
Posted on 08-11-2014 12:08 PM
Back again. thanks for the logging tip, hadn't thought of that. Log says it's doing what it should. But no change until I restart (not even log out/in). Guessing this is becoming more of a dockutil-specific issue. 2.0 is suppose to handle the dock cache better than previous versions.
The change isn't perfect either. It looks like the default apps are getting put into the modified dock. saw a thread about that here, so I need to look into that too.