| 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: |
| 11 # 0 Happiness | 11 # 0 Happiness |
| 12 # 1 Unknown failure | 12 # 1 Unknown failure |
| 13 # 2 Basic sanity check source failure (e.g. no app on disk image) | 13 # 2 Basic sanity check source failure (e.g. no app on disk image) |
| 14 # 3 Basic sanity check destination failure (e.g. ticket points to nothing) | 14 # 3 Basic sanity check destination failure (e.g. ticket points to nothing) |
| 15 # 4 Update driven by user ticket when a system ticket is also present | 15 # 4 Update driven by user ticket when a system ticket is also present |
| 16 # 5 Could not prepare existing installed version to receive update | 16 # 5 Could not prepare existing installed version to receive update |
| 17 # 6 rsync failed (could not assure presence of Versions directory) | 17 # 6 rsync failed (could not assure presence of Versions directory) |
| 18 # 7 rsync failed (could not copy new versioned directory to Versions) | 18 # 7 rsync failed (could not copy new versioned directory to Versions) |
| 19 # 8 rsync failed (could not update outer .app bundle) | 19 # 8 rsync failed (could not update outer .app bundle) |
| 20 # 9 Could not get the version, update URL, or channel after update | 20 # 9 Could not get the version, update URL, or channel after update |
| 21 # 10 Updated application does not have the version number from the update | 21 # 10 Updated application does not have the version number from the update |
| 22 # 11 ksadmin failure | 22 # 11 ksadmin failure |
| 23 | 23 |
| 24 set -e | 24 set -e |
| 25 | 25 |
| 26 # http://b/2290916: Keystone runs the installation with a restrictive PATH |
| 27 # that only includes the directory containing ksadmin, /bin, and /usr/bin. It |
| 28 # does not include /sbin or /usr/sbin. This script uses lsof, which is in |
| 29 # /usr/sbin, and it's conceivable that it might want to use other tools in an |
| 30 # sbin directory. Adjust the path accordingly. |
| 31 export PATH="${PATH}:/sbin:/usr/sbin" |
| 32 |
| 26 # Returns 0 (true) if the parameter exists, is a symbolic link, and appears | 33 # Returns 0 (true) if the parameter exists, is a symbolic link, and appears |
| 27 # writable on the basis of its POSIX permissions. This is used to determine | 34 # writable on the basis of its POSIX permissions. This is used to determine |
| 28 # writeability like test's -w primary, but -w resolves symbolic links and this | 35 # writeability like test's -w primary, but -w resolves symbolic links and this |
| 29 # function does not. | 36 # function does not. |
| 30 function is_writable_symlink() { | 37 function is_writable_symlink() { |
| 31 SYMLINK=${1} | 38 SYMLINK=${1} |
| 32 LINKMODE=$(stat -f %Sp "${SYMLINK}" 2> /dev/null || true) | 39 LINKMODE=$(stat -f %Sp "${SYMLINK}" 2> /dev/null || true) |
| 33 if [ -z "${LINKMODE}" ] || [ "${LINKMODE:0:1}" != "l" ] ; then | 40 if [ -z "${LINKMODE}" ] || [ "${LINKMODE:0:1}" != "l" ] ; then |
| 34 return 1 | 41 return 1 |
| 35 fi | 42 fi |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 ([ ${OS_MAJOR} -eq 10 ] && [ ${OS_MINOR} -ge 6 ]) ; then | 504 ([ ${OS_MAJOR} -eq 10 ] && [ ${OS_MINOR} -ge 6 ]) ; then |
| 498 # On 10.6, xattr supports -r for recursive operation. | 505 # On 10.6, xattr supports -r for recursive operation. |
| 499 xattr -d -r "${QUARANTINE_ATTR}" "${DEST}" >& /dev/null | 506 xattr -d -r "${QUARANTINE_ATTR}" "${DEST}" >& /dev/null |
| 500 else | 507 else |
| 501 # On earlier systems, xattr doesn't support -r, so run xattr via find. | 508 # On earlier systems, xattr doesn't support -r, so run xattr via find. |
| 502 find "${DEST}" -exec xattr -d "${QUARANTINE_ATTR}" {} + >& /dev/null | 509 find "${DEST}" -exec xattr -d "${QUARANTINE_ATTR}" {} + >& /dev/null |
| 503 fi | 510 fi |
| 504 | 511 |
| 505 # Great success! | 512 # Great success! |
| 506 exit 0 | 513 exit 0 |
| OLD | NEW |