It has been a long time coming, but I finally made time to attempt to get dockutil working better with cfprefsd.
I decided to use defaults rather than PyObjC. Although in hindsight it probably doesn’t matter. They both have quirks when running as root.
But defaults actually does handle paths correctly, and dockutil has always used paths to the dock plist, so that fits well.
At some point we will likely need to change dockutil to take users or domains rather than paths so it works better with CFPreferences.
But for now we can stay with paths to preserve compatibility with existing scripts using dockutil.
I expect some bugs, so please test and report them on github.
Once in a while you run into a package or program that will only work properly with a user logged in. This can ruin your day if you need to automated the deployment.
I found this method of automatically logging in a user (which is quite awesome).
Using that perl script along with a wrapper script can enable you to automate these can other cases where your only option is to have a user logged in.
I started writing a script to handle this, but it turned out I didn’t need it. The script is unfinished, but it may give you a head start if you are considering something similar.
It depends on a modified version of the perl script that accepts a username and password. Just swap out the user and password lines with these that accept arguments.
my $user = $ARGV;
my $pass = $ARGV;
and I comment out the line to automatically restarts the loginwindow.