OLD | NEW |
(Empty) | |
| 1 #!/bin/sh |
| 2 |
| 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. |
| 6 |
| 7 # Called by the Keystone system to update the installed application with a new |
| 8 # version from a disk image. |
| 9 |
| 10 set -e |
| 11 |
| 12 # The argument should be the disk image path. Make sure it exists. |
| 13 if [ ! -d "${1}" ] ; then |
| 14 exit 1 |
| 15 fi |
| 16 |
| 17 # Who we are. |
| 18 APP_NAME="Chromium TestShell.app" |
| 19 SRC="${1}/${APP_NAME}" |
| 20 |
| 21 # Sanity, make sure that there's something to copy from. |
| 22 if [ ! -d "${SRC}" ] ; then |
| 23 exit 1 |
| 24 fi |
| 25 |
| 26 # Figure out where we're going. |
| 27 BUNDLE_ID=$(defaults read "${SRC}/Contents/Info" CFBundleIdentifier) |
| 28 DEST=$(ksadmin -pP "${BUNDLE_ID}" | grep xc= | sed -E 's/.+path=(.+)>$/\1/g') |
| 29 |
| 30 # More sanity checking. |
| 31 if [ -z "${SRC}" ] || [ -z "${DEST}" ] || [ ! -d $(dirname "${DEST}") ]; then |
| 32 exit 1 |
| 33 fi |
| 34 |
| 35 # This usage will preserve any changes the user made to the application name. |
| 36 rsync -a --delete "${SRC}/" "${DEST}/" |
| 37 |
| 38 VERSION=$(defaults read "${DEST}/Contents/Info" SVNRevision) |
| 39 URL=$(defaults read "${DEST}/Contents/Info" KSUpdateURL) |
| 40 |
| 41 # Notify LaunchServices. |
| 42 /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.fram
ework/Support/lsregister "${DEST}" |
| 43 |
| 44 # Notify Keystone. |
| 45 ksadmin -P "${BUNDLE_ID}" \ |
| 46 --version "${VERSION}" \ |
| 47 --xcpath "${DEST}" \ |
| 48 --url "${URL}" |
| 49 |
| 50 # Great success! |
| 51 exit 0 |
OLD | NEW |