OLD | NEW |
1 #!/bin/bash -p | 1 #!/bin/bash -p |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 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 # usage: keystone_install.sh update_dmg_mount_point | 7 # usage: keystone_install.sh update_dmg_mount_point |
8 # | 8 # |
9 # Called by the Keystone system to update the installed application with a new | 9 # Called by the Keystone system to update the installed application with a new |
10 # version from a disk image. | 10 # version from a disk image. |
(...skipping 11 matching lines...) Expand all Loading... |
22 # 2 Basic sanity check source failure (e.g. no app on disk image) | 22 # 2 Basic sanity check source failure (e.g. no app on disk image) |
23 # 3 Basic sanity check destination failure (e.g. ticket points to nothing) | 23 # 3 Basic sanity check destination failure (e.g. ticket points to nothing) |
24 # 4 Update driven by user ticket when a system ticket is also present | 24 # 4 Update driven by user ticket when a system ticket is also present |
25 # 5 Could not prepare existing installed version to receive update | 25 # 5 Could not prepare existing installed version to receive update |
26 # 6 Patch sanity check failure | 26 # 6 Patch sanity check failure |
27 # 7 rsync failed (could not copy new versioned directory to Versions) | 27 # 7 rsync failed (could not copy new versioned directory to Versions) |
28 # 8 rsync failed (could not update outer .app bundle) | 28 # 8 rsync failed (could not update outer .app bundle) |
29 # 9 Could not get the version, update URL, or channel after update | 29 # 9 Could not get the version, update URL, or channel after update |
30 # 10 Updated application does not have the version number from the update | 30 # 10 Updated application does not have the version number from the update |
31 # 11 ksadmin failure | 31 # 11 ksadmin failure |
| 32 # 12 dirpatcher failed for versioned directory |
| 33 # 13 dirpatcher failed for outer .app bundle |
32 # | 34 # |
33 # The following exit codes can be used to convey special meaning to Keystone: | 35 # The following exit codes can be used to convey special meaning to Keystone. |
| 36 # KeystoneRegistration will present these codes to Chrome as "success." |
34 # 66 (unused) success, request reboot | 37 # 66 (unused) success, request reboot |
35 # 77 try installation again later | 38 # 77 (unused) try installation again later |
36 | 39 |
37 set -eu | 40 set -eu |
38 | 41 |
39 # http://b/2290916: Keystone runs the installation with a restrictive PATH | 42 # http://b/2290916: Keystone runs the installation with a restrictive PATH |
40 # that only includes the directory containing ksadmin, /bin, and /usr/bin. It | 43 # that only includes the directory containing ksadmin, /bin, and /usr/bin. It |
41 # does not include /sbin or /usr/sbin. This script uses lsof, which is in | 44 # does not include /sbin or /usr/sbin. This script uses lsof, which is in |
42 # /usr/sbin, and it's conceivable that it might want to use other tools in an | 45 # /usr/sbin, and it's conceivable that it might want to use other tools in an |
43 # sbin directory. Adjust the path accordingly. | 46 # sbin directory. Adjust the path accordingly. |
44 export PATH="${PATH}:/sbin:/usr/sbin" | 47 export PATH="${PATH}:/sbin:/usr/sbin" |
45 | 48 |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 note "dirpatching versioned directory" | 1021 note "dirpatching versioned directory" |
1019 if ! "${dirpatcher}" "${old_versioned_dir}" \ | 1022 if ! "${dirpatcher}" "${old_versioned_dir}" \ |
1020 "${patch_versioned_dir}" \ | 1023 "${patch_versioned_dir}" \ |
1021 "${versioned_dir_target}"; then | 1024 "${versioned_dir_target}"; then |
1022 err "dirpatcher of versioned directory failed, status ${PIPESTATUS[0]}" | 1025 err "dirpatcher of versioned directory failed, status ${PIPESTATUS[0]}" |
1023 mark_failed_patch_update "${product_id}" \ | 1026 mark_failed_patch_update "${product_id}" \ |
1024 "${want_full_installer_path}" \ | 1027 "${want_full_installer_path}" \ |
1025 "${old_ks_plist}" \ | 1028 "${old_ks_plist}" \ |
1026 "${old_version_app}" \ | 1029 "${old_version_app}" \ |
1027 "${system_ticket}" | 1030 "${system_ticket}" |
1028 exit 77 | 1031 exit 12 |
1029 fi | 1032 fi |
1030 fi | 1033 fi |
1031 | 1034 |
1032 # Copy the versioned directory. The new versioned directory should have a | 1035 # Copy the versioned directory. The new versioned directory should have a |
1033 # different name than any existing one, so this won't harm anything already | 1036 # different name than any existing one, so this won't harm anything already |
1034 # present in ${installed_versions_dir}, including the versioned directory | 1037 # present in ${installed_versions_dir}, including the versioned directory |
1035 # being used by any running processes. If this step is interrupted, there | 1038 # being used by any running processes. If this step is interrupted, there |
1036 # will be an incomplete versioned directory left behind, but it won't | 1039 # will be an incomplete versioned directory left behind, but it won't |
1037 # won't interfere with anything, and it will be replaced or removed during a | 1040 # won't interfere with anything, and it will be replaced or removed during a |
1038 # future update attempt. | 1041 # future update attempt. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 note "dirpatching app directory" | 1080 note "dirpatching app directory" |
1078 if ! "${dirpatcher}" "${installed_app}" \ | 1081 if ! "${dirpatcher}" "${installed_app}" \ |
1079 "${patch_app_dir}" \ | 1082 "${patch_app_dir}" \ |
1080 "${update_app}"; then | 1083 "${update_app}"; then |
1081 err "dirpatcher of app directory failed, status ${PIPESTATUS[0]}" | 1084 err "dirpatcher of app directory failed, status ${PIPESTATUS[0]}" |
1082 mark_failed_patch_update "${product_id}" \ | 1085 mark_failed_patch_update "${product_id}" \ |
1083 "${want_full_installer_path}" \ | 1086 "${want_full_installer_path}" \ |
1084 "${old_ks_plist}" \ | 1087 "${old_ks_plist}" \ |
1085 "${old_version_app}" \ | 1088 "${old_version_app}" \ |
1086 "${system_ticket}" | 1089 "${system_ticket}" |
1087 exit 77 | 1090 exit 13 |
1088 fi | 1091 fi |
1089 fi | 1092 fi |
1090 | 1093 |
1091 # See if the timestamp of what's currently on disk is newer than the | 1094 # See if the timestamp of what's currently on disk is newer than the |
1092 # update's outer .app's timestamp. rsync will copy the update's timestamp | 1095 # update's outer .app's timestamp. rsync will copy the update's timestamp |
1093 # over, but if that timestamp isn't as recent as what's already on disk, the | 1096 # over, but if that timestamp isn't as recent as what's already on disk, the |
1094 # .app will need to be touched. | 1097 # .app will need to be touched. |
1095 local needs_touch= | 1098 local needs_touch= |
1096 if [[ "${installed_app}" -nt "${update_app}" ]]; then | 1099 if [[ "${installed_app}" -nt "${update_app}" ]]; then |
1097 needs_touch="y" | 1100 needs_touch="y" |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1547 | 1550 |
1548 # Check "less than" instead of "not equal to" in case Keystone ever changes to | 1551 # Check "less than" instead of "not equal to" in case Keystone ever changes to |
1549 # pass more arguments. | 1552 # pass more arguments. |
1550 if [[ ${#} -lt 1 ]]; then | 1553 if [[ ${#} -lt 1 ]]; then |
1551 usage | 1554 usage |
1552 exit 2 | 1555 exit 2 |
1553 fi | 1556 fi |
1554 | 1557 |
1555 main "${@}" | 1558 main "${@}" |
1556 exit ${?} | 1559 exit ${?} |
OLD | NEW |