OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Called by the Keystone system to update the installed application with a new | 7 # Called by the Keystone system to update the installed application with a new |
8 # version from a disk image. | 8 # version from a disk image. |
9 | 9 |
10 # Return values: | 10 # Return values: |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 if [ -z "${SRC}" ] || [ "${SRC:0:1}" != "/" ] || [ ! -d "${SRC}" ] ; then | 224 if [ -z "${SRC}" ] || [ "${SRC:0:1}" != "/" ] || [ ! -d "${SRC}" ] ; then |
225 exit 2 | 225 exit 2 |
226 fi | 226 fi |
227 | 227 |
228 # Figure out where we're going. Determine the application version to be | 228 # Figure out where we're going. Determine the application version to be |
229 # installed, use that to locate the framework, and then look inside the | 229 # installed, use that to locate the framework, and then look inside the |
230 # framework for the Keystone product ID. | 230 # framework for the Keystone product ID. |
231 APP_VERSION_KEY="CFBundleShortVersionString" | 231 APP_VERSION_KEY="CFBundleShortVersionString" |
232 UPD_VERSION_APP=$(defaults read "${SRC}/Contents/Info" "${APP_VERSION_KEY}" || | 232 UPD_VERSION_APP=$(defaults read "${SRC}/Contents/Info" "${APP_VERSION_KEY}" || |
233 exit 2) | 233 exit 2) |
234 UPD_KS_PLIST="${SRC}/Contents/Versions/${UPD_VERSION_APP}/${FRAMEWORK_DIR}/Resou
rces/Info" | 234 UPD_KS_PLIST="${SRC}/Contents/Info" |
235 KS_VERSION_KEY="KSVersion" | 235 KS_VERSION_KEY="KSVersion" |
236 UPD_VERSION_KS=$(defaults read "${UPD_KS_PLIST}" "${KS_VERSION_KEY}" || exit 2) | 236 UPD_VERSION_KS=$(defaults read "${UPD_KS_PLIST}" "${KS_VERSION_KEY}" || exit 2) |
237 PRODUCT_ID=$(defaults read "${UPD_KS_PLIST}" KSProductID || exit 2) | 237 PRODUCT_ID=$(defaults read "${UPD_KS_PLIST}" KSProductID || exit 2) |
238 if [ -z "${UPD_VERSION_KS}" ] || [ -z "${PRODUCT_ID}" ] ; then | 238 if [ -z "${UPD_VERSION_KS}" ] || [ -z "${PRODUCT_ID}" ] ; then |
239 exit 3 | 239 exit 3 |
240 fi | 240 fi |
241 DEST=$(ksadmin -pP "${PRODUCT_ID}" | | 241 DEST=$(ksadmin -pP "${PRODUCT_ID}" | |
242 sed -Ene \ | 242 sed -Ene \ |
243 's%^[[:space:]]+xc=<KSPathExistenceChecker:.* path=(/.+)>$%\1%p') | 243 's%^[[:space:]]+xc=<KSPathExistenceChecker:.* path=(/.+)>$%\1%p') |
244 | 244 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 # timestamp to something newer than what had been on disk. This is not | 402 # timestamp to something newer than what had been on disk. This is not |
403 # considered a critical step, and if it fails, this script will not exit. | 403 # considered a critical step, and if it fails, this script will not exit. |
404 if [ -n "${NEEDS_TOUCH}" ] ; then | 404 if [ -n "${NEEDS_TOUCH}" ] ; then |
405 touch -cf "${DEST}" || true | 405 touch -cf "${DEST}" || true |
406 fi | 406 fi |
407 | 407 |
408 # Read the new values (e.g. version). Get the installed application version | 408 # Read the new values (e.g. version). Get the installed application version |
409 # to get the path to the framework, where the Keystone keys are stored. | 409 # to get the path to the framework, where the Keystone keys are stored. |
410 NEW_VERSION_APP=$(defaults read "${DEST}/Contents/Info" "${APP_VERSION_KEY}" || | 410 NEW_VERSION_APP=$(defaults read "${DEST}/Contents/Info" "${APP_VERSION_KEY}" || |
411 exit 9) | 411 exit 9) |
412 NEW_KS_PLIST="${DEST}/Contents/Versions/${NEW_VERSION_APP}/${FRAMEWORK_DIR}/Reso
urces/Info" | 412 NEW_KS_PLIST="${DEST}/Contents/Info" |
413 NEW_VERSION_KS=$(defaults read "${NEW_KS_PLIST}" "${KS_VERSION_KEY}" || exit 9) | 413 NEW_VERSION_KS=$(defaults read "${NEW_KS_PLIST}" "${KS_VERSION_KEY}" || exit 9) |
414 URL=$(defaults read "${NEW_KS_PLIST}" KSUpdateURL || exit 9) | 414 URL=$(defaults read "${NEW_KS_PLIST}" KSUpdateURL || exit 9) |
415 # The channel ID is optional. Suppress stderr to prevent Keystone from seeing | 415 # The channel ID is optional. Suppress stderr to prevent Keystone from seeing |
416 # possible error output. | 416 # possible error output. |
417 CHANNEL_ID_KEY=KSChannelID | 417 CHANNEL_ID_KEY=KSChannelID |
418 CHANNEL_ID=$(defaults read "${NEW_KS_PLIST}" "${CHANNEL_ID_KEY}" 2>/dev/null || | 418 CHANNEL_ID=$(defaults read "${NEW_KS_PLIST}" "${CHANNEL_ID_KEY}" 2>/dev/null || |
419 true) | 419 true) |
420 | 420 |
421 # Make sure that the update was successful by comparing the version found in | 421 # Make sure that the update was successful by comparing the version found in |
422 # the update with the version now on disk. | 422 # the update with the version now on disk. |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 ([ ${OS_MAJOR} -eq 10 ] && [ ${OS_MINOR} -ge 6 ]) ; then | 654 ([ ${OS_MAJOR} -eq 10 ] && [ ${OS_MINOR} -ge 6 ]) ; then |
655 # On 10.6, xattr supports -r for recursive operation. | 655 # On 10.6, xattr supports -r for recursive operation. |
656 xattr -d -r "${QUARANTINE_ATTR}" "${DEST}" >& /dev/null | 656 xattr -d -r "${QUARANTINE_ATTR}" "${DEST}" >& /dev/null |
657 else | 657 else |
658 # On earlier systems, xattr doesn't support -r, so run xattr via find. | 658 # On earlier systems, xattr doesn't support -r, so run xattr via find. |
659 find "${DEST}" -exec xattr -d "${QUARANTINE_ATTR}" {} + >& /dev/null | 659 find "${DEST}" -exec xattr -d "${QUARANTINE_ATTR}" {} + >& /dev/null |
660 fi | 660 fi |
661 | 661 |
662 # Great success! | 662 # Great success! |
663 exit 0 | 663 exit 0 |
OLD | NEW |