Mac – Scripting Chrome’s Auto-Update Feature

If you’re an IT sysadmin and would like to automagically ensure that Chrome auto-updates itself for all users on a machine, you can do so with this simple ruby script:

https://github.com/Ginja/Admin_Scripts/blob/master/chrome_auto-update.rb

Regular users with administrative privilege can do this without a script just by clicking on “Chrome->About Google Chrome” and then following the button prompts. If you see nothing indicating that you should enable auto-updates, then it’s already done. Chrome does nag you to do this when you first use it.

If you’re using munki to deploy packages I recommend adding this script as a post-install script. You could also run it on clients using Apple Remote Desktop. For the curious, a more detailed explanation on what this script does after the jump.

This script installs/registers Google’s Keystone daemon, which controls the updating process via the KeystoneRegistration.framework, and then registers Chrome with Keystone.

Install/Register Keystone

Every version of Google Chrome comes with a copy of the KeystoneRegistration.framework. So since the latest version at the time of writing this is 19.0.1084.46, I would use the Keystone script inside the 19.0.1084.46 folder inside the Google Chrome.app:

cd "/Applications/Google Chrome.app/Contents/Versions/19.0.1084.46/Google Chrome Framework.framework/Frameworks/KeystoneRegistration.framework/Resources/"

sudo ./install.py --install=Keystone.tbz --root=/

The “–root=/” specifies that we want Chrome to be able to be updated system-wide. Otherwise the argument would look like “-root=/Users/joeblow”, and then Chrome could only auto-update when joeblow was logged in.

Registering Chrome with Keystone

The ksadmin command requires alot of arguments, way too many. I’m pretty sure it’s breaking some sort of record:

cd /Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/MacOS/

sudo ./ksadmin --register --preserve-tttoken --productid com.google.Chrome --version 19.0.1084.52 --xcpath "/Applications/Google Chrome.app" --url https://tools.google.com/service/update2 --tag-path "/Applications/Google Chrome.app/Contents/Info.plist" --tag-key KSChannelID --brand-path "/Library/Google/Google Chrome Brand.plist" --brand-key KSBrandID --version-path "/Applications/Google Chrome.app/Contents/Info.plist" --version-key KSVersion

Original credit for the auto-update script goes to Hannes Juutilainen. I simply just rewrote it ruby.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s