Automatically get the latest Chromium snapshot with launchd

I’ve been checking out the snapshots of Chromium recently, and they’re coming quicker than you can say “multithreaded web browser.” To facilitate always having the latest version, I wrote a quick LaunchAgent that takes care of it on Mac OS X. First, I have a script named ~/bin/chromiupdate:


# Downloads the latest version of Chromium.

    rm -rf "${WORKING_DIR}"
    exit 0

USER_DIR=$(dscl . -read /Users/$(whoami) NFSHomeDirectory | awk '{ print $2 }')

if [ ! -d "${CHROMIUM_DIR}" ]; then
    mkdir -p "${CHROMIUM_DIR}"

INSTALLED_VERSION="$(defaults read "${CHROMIUM_DIR}/Contents/Info" SVNRevision)"

if [ "${VERSION}" != "${INSTALLED_VERSION}" ]; then
    logger Installed Chromium version \(${INSTALLED_VERSION}\) does not equal \
            latest version \(${VERSION}\), updating now...
    mkdir "${WORKING_DIR}" || exit 1
    trap remove_working_dir 1 2 3 6 15
    cd "${WORKING_DIR}" || exit 1
    curl -O "${URL_BEGIN}/${VERSION}/"
    rsync -HavP --exclude="Contents/MacOS/chrome_debug.log" \
          "${WORKING_DIR}/chrome-mac/" "${CHROMIUM_DIR}/"

    if [ "$(ps -aef | grep -i chromium | grep -v grep)" != "" ]; then
        open "${USER_DIR}/Library/Scripts/Chromium Update"

    logger "Chromium update complete. Version ${VERSION} installed."

    logger Installed Chromium version \(${INSTALLED_VERSION}\) is up-to-date. \
           No action needed.

exit 0

Next, I have a property list named ~/Library/LaunchAgents/com.slaunchaman.chromium.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN >
<plist version="1.0">

Finally, I have an AppleScript at ~/Library/Scripts/Chromium Update

display dialog "Chromium was just updated. You should restart it."

The LaunchAgent runs once an hour, checking to see if the installed version of Chromium is older than the latest snapshot. If so, it downloads it and uses rsync to copy the changes. The script places Chromium in ~/Applications, but it shouldn’t be hard to modify to put it into /Applications.

New Safari 3.2 Feature: Secure Website Identification

Here’s a quick tip that slipped through the blogosphere (at least none of the Mac blogs I subscribe to featured it): in Safari 3.2, released last week, Apple’s added a feature from Firefox 3’s “awesome bar”: when you’re on a secure website, such as a bank’s, that has identification information, it’s displayed in green (though in Safari it’s at the top-right of the title bar).  A screenshot:


Safari 3.2 adds secure website information to the title bar.
Safari 3.2 adds secure website information to the title bar.

Along with a phishing filter, it looks like Safari is stepping up to the plate as a secure browser.