diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-23 20:38:10 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-23 20:38:10 +0000 |
commit | 00f6618c63e8246693a3f315c99e3034ec3774aa (patch) | |
tree | 01a64227cd5a9125d71d6a8668950b18afc99de2 /webkit/tools/test_shell/mac/keystone_install.sh | |
parent | 60226f128b1175e47ce5154f447a7efa43cc949f (diff) | |
download | chromium_src-00f6618c63e8246693a3f315c99e3034ec3774aa.zip chromium_src-00f6618c63e8246693a3f315c99e3034ec3774aa.tar.gz chromium_src-00f6618c63e8246693a3f315c99e3034ec3774aa.tar.bz2 |
Keystone auto-update support for TestShell
Review URL: http://codereview.chromium.org/18521
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8574 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/mac/keystone_install.sh')
-rwxr-xr-x | webkit/tools/test_shell/mac/keystone_install.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/mac/keystone_install.sh b/webkit/tools/test_shell/mac/keystone_install.sh new file mode 100755 index 0000000..b2e42f6 --- /dev/null +++ b/webkit/tools/test_shell/mac/keystone_install.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +# Copyright (c) 2009 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Called by the Keystone system to update the installed application with a new +# version from a disk image. + +set -e + +# The argument should be the disk image path. Make sure it exists. +if [ ! -d "${1}" ] ; then + exit 1 +fi + +# Who we are. +APP_NAME="Chromium TestShell.app" +SRC="${1}/${APP_NAME}" + +# Sanity, make sure that there's something to copy from. +if [ ! -d "${SRC}" ] ; then + exit 1 +fi + +# Figure out where we're going. +BUNDLE_ID=$(defaults read "${SRC}/Contents/Info" CFBundleIdentifier) +DEST=$(ksadmin -pP "${BUNDLE_ID}" | grep xc= | sed -E 's/.+path=(.+)>$/\1/g') + +# More sanity checking. +if [ -z "${SRC}" ] || [ -z "${DEST}" ] || [ ! -d $(dirname "${DEST}") ]; then + exit 1 +fi + +# This usage will preserve any changes the user made to the application name. +rsync -a --delete "${SRC}/" "${DEST}/" + +VERSION=$(defaults read "${DEST}/Contents/Info" SVNRevision) +URL=$(defaults read "${DEST}/Contents/Info" KSUpdateURL) + +# Notify LaunchServices. +/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister "${DEST}" + +# Notify Keystone. +ksadmin -P "${BUNDLE_ID}" \ + --version "${VERSION}" \ + --xcpath "${DEST}" \ + --url "${URL}" + +# Great success! +exit 0 |