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 | |
34 # | 32 # |
35 # The following exit codes are not used by this script, but can be used to | 33 # The following exit codes are not used by this script, but can be used to |
Nico
2014/01/02 23:56:28
or are they?
| |
36 # convey special meaning to Keystone: | 34 # convey special meaning to Keystone: |
37 # 66 (unused) success, request reboot | 35 # 66 (unused) success, request reboot |
38 # 77 (unused) try installation again later | 36 # 77 try installation again later |
39 | 37 |
40 set -eu | 38 set -eu |
41 | 39 |
42 # http://b/2290916: Keystone runs the installation with a restrictive PATH | 40 # http://b/2290916: Keystone runs the installation with a restrictive PATH |
43 # that only includes the directory containing ksadmin, /bin, and /usr/bin. It | 41 # that only includes the directory containing ksadmin, /bin, and /usr/bin. It |
44 # does not include /sbin or /usr/sbin. This script uses lsof, which is in | 42 # does not include /sbin or /usr/sbin. This script uses lsof, which is in |
45 # /usr/sbin, and it's conceivable that it might want to use other tools in an | 43 # /usr/sbin, and it's conceivable that it might want to use other tools in an |
46 # sbin directory. Adjust the path accordingly. | 44 # sbin directory. Adjust the path accordingly. |
47 export PATH="${PATH}:/sbin:/usr/sbin" | 45 export PATH="${PATH}:/sbin:/usr/sbin" |
48 | 46 |
49 # Environment sanitization. Clear environment variables that might impact the | 47 # Environment sanitization. Clear environment variables that might impact the |
50 # interpreter's operation. The |bash -p| invocation on the #! line takes the | 48 # interpreter's operation. The |bash -p| invocation on the #! line takes the |
51 # bite out of BASH_ENV, ENV, and SHELLOPTS (among other features), but | 49 # bite out of BASH_ENV, ENV, and SHELLOPTS (among other features), but |
52 # clearing them here ensures that they won't impact any shell scripts used as | 50 # clearing them here ensures that they won't impact any shell scripts used as |
53 # utility programs. SHELLOPTS is read-only and can't be unset, only | 51 # utility programs. SHELLOPTS is read-only and can't be unset, only |
54 # unexported. | 52 # unexported. |
55 unset BASH_ENV CDPATH ENV GLOBIGNORE IFS POSIXLY_CORRECT | 53 unset BASH_ENV CDPATH ENV GLOBIGNORE IFS POSIXLY_CORRECT |
56 export -n SHELLOPTS | 54 export -n SHELLOPTS |
57 | 55 |
58 set -o pipefail | 56 set -o pipefail |
59 shopt -s nullglob | 57 shopt -s nullglob |
60 | 58 |
61 ME="$(basename "${0}")" | 59 ME="$(basename "${0}")" |
62 readonly ME | 60 readonly ME |
63 | 61 |
62 readonly KS_CHANNEL_KEY="KSChannelID" | |
63 | |
64 # Workaround for http://code.google.com/p/chromium/issues/detail?id=83180#c3 | 64 # Workaround for http://code.google.com/p/chromium/issues/detail?id=83180#c3 |
65 # In bash 4.0, "declare VAR" no longer initializes VAR if not already set. | 65 # In bash 4.0, "declare VAR" no longer initializes VAR if not already set. |
66 : ${GOOGLE_CHROME_UPDATER_DEBUG:=} | 66 : ${GOOGLE_CHROME_UPDATER_DEBUG:=} |
67 err() { | 67 err() { |
68 local error="${1}" | 68 local error="${1}" |
69 | 69 |
70 local id= | 70 local id= |
71 if [[ -n "${GOOGLE_CHROME_UPDATER_DEBUG}" ]]; then | 71 if [[ -n "${GOOGLE_CHROME_UPDATER_DEBUG}" ]]; then |
72 id=": ${$} $(date "+%Y-%m-%d %H:%M:%S %z")" | 72 id=": ${$} $(date "+%Y-%m-%d %H:%M:%S %z")" |
73 fi | 73 fi |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
444 | 444 |
445 # Returns 0 (true) if ksadmin supports --version-path and --version-key. | 445 # Returns 0 (true) if ksadmin supports --version-path and --version-key. |
446 ksadmin_supports_versionpath_versionkey() { | 446 ksadmin_supports_versionpath_versionkey() { |
447 # --version-path and --version-key were introduced in Keystone 1.0.9.2318. | 447 # --version-path and --version-key were introduced in Keystone 1.0.9.2318. |
448 is_ksadmin_version_ge 1.0.9.2318 | 448 is_ksadmin_version_ge 1.0.9.2318 |
449 | 449 |
450 # The return value of is_ksadmin_version_ge is used as this function's | 450 # The return value of is_ksadmin_version_ge is used as this function's |
451 # return value. | 451 # return value. |
452 } | 452 } |
453 | 453 |
454 has_32_bit_only_cpu() { | |
455 local cpu_64_bit_capable="$(sysctl -n hw.cpu64bit_capable 2>/dev/null)" | |
456 [[ -z "${cpu_64_bit_capable}" || "${cpu_64_bit_capable}" -eq 0 ]] | |
457 | |
458 # The return value of the comparison is used as this function's return | |
459 # value. | |
460 } | |
461 | |
454 # Runs "defaults read" to obtain the value of a key in a property list. As | 462 # Runs "defaults read" to obtain the value of a key in a property list. As |
455 # with "defaults read", an absolute path to a plist is supplied, without the | 463 # with "defaults read", an absolute path to a plist is supplied, without the |
456 # ".plist" extension. | 464 # ".plist" extension. |
457 # | 465 # |
458 # As of Mac OS X 10.8, defaults (and NSUserDefaults and CFPreferences) | 466 # As of Mac OS X 10.8, defaults (and NSUserDefaults and CFPreferences) |
459 # normally communicates with cfprefsd to read and write plists. Changes to a | 467 # normally communicates with cfprefsd to read and write plists. Changes to a |
460 # plist file aren't necessarily reflected immediately via this API family when | 468 # plist file aren't necessarily reflected immediately via this API family when |
461 # not made through this API family, because cfprefsd may return cached data | 469 # not made through this API family, because cfprefsd may return cached data |
462 # from a former on-disk version of a plist file instead of reading the current | 470 # from a former on-disk version of a plist file instead of reading the current |
463 # version from disk. The old behavior can be restored by setting the | 471 # version from disk. The old behavior can be restored by setting the |
(...skipping 13 matching lines...) Expand all Loading... | |
477 # This function exists because the update process delivers new copies of | 485 # This function exists because the update process delivers new copies of |
478 # Info.plist files to the disk behind cfprefsd's back, and if cfprefsd becomes | 486 # Info.plist files to the disk behind cfprefsd's back, and if cfprefsd becomes |
479 # aware of the original version of the file for any reason (such as this | 487 # aware of the original version of the file for any reason (such as this |
480 # script reading values from it via "defaults read"), the new version of the | 488 # script reading values from it via "defaults read"), the new version of the |
481 # file will not be immediately effective or visible via cfprefsd after the | 489 # file will not be immediately effective or visible via cfprefsd after the |
482 # update is applied. | 490 # update is applied. |
483 infoplist_read() { | 491 infoplist_read() { |
484 __CFPREFERENCES_AVOID_DAEMON=1 defaults read "${@}" | 492 __CFPREFERENCES_AVOID_DAEMON=1 defaults read "${@}" |
485 } | 493 } |
486 | 494 |
495 mark_failed_patch_update() { | |
496 local product_id="${1}" | |
497 local want_full_installer_path="${2}" | |
498 local old_ks_plist="${3}" | |
499 local old_version_app="${4}" | |
500 | |
501 set +e | |
502 | |
503 note "marking failed patch update" | |
504 | |
505 # Chrome can't easily read its Keystone ticket prior to registration, and | |
506 # when Chrome registers with Keystone, it obliterates old tag values in its | |
507 # ticket. Therefore, an alternative mechanism is provided to signal to | |
508 # Chrome that a full installer is desired. If the .want_full_installer file | |
509 # is present and it contains Chrome's current version number, Chrome will | |
510 # include "-full" in its tag when it registers with Keystone. This allows | |
511 # "-full" to persist in the tag even after Chrome is relaunched, which on a | |
512 # user ticket, triggers a re-registration. | |
513 echo "${old_version_app}" > "${want_full_installer_path}" | |
514 chmod 644 "${want_full_installer_path}" | |
515 | |
516 local old_ks_plist_path="${old_ks_plist}.plist" | |
517 | |
518 local channel | |
519 channel="$(infoplist_read "${old_ks_plist}" "${KS_CHANNEL_KEY}" 2> /dev/null)" | |
520 | |
521 local tag="${channel}" | |
522 local tag_key="${KS_CHANNEL_KEY}" | |
523 if has_32_bit_only_cpu; then | |
524 tag="${tag}-32bit" | |
525 tag_key="${tag_key}-32bit" | |
526 fi | |
527 | |
528 tag="${tag}-full" | |
529 tag_key="${tag_key}-full" | |
530 | |
531 note "tag = ${tag}" | |
532 note "tag_key = ${tag_key}" | |
533 | |
534 # Using ksadmin without --register only updates specified values in the | |
535 # ticket, without changing existing values. | |
Nico
2014/01/02 23:56:28
…without changing other existing…
| |
536 local ksadmin_args=( | |
537 --productid "${product_id}" | |
538 ) | |
539 | |
540 if ksadmin_supports_tag; then | |
541 ksadmin_args+=( | |
542 --tag "${tag}" | |
543 ) | |
544 fi | |
545 | |
546 if ksadmin_supports_tagpath_tagkey; then | |
547 ksadmin_args+=( | |
548 --tag-path "${old_ks_plist_path}" | |
549 --tag-key "${tag_key}" | |
550 ) | |
551 fi | |
552 | |
553 note "ksadmin_args = ${ksadmin_args[*]}" | |
554 | |
555 if ! ksadmin "${ksadmin_args[@]}"; then | |
556 err "ksadmin failed" | |
557 fi | |
558 | |
559 note "marked failed patch update" | |
560 | |
561 set -e | |
562 } | |
563 | |
487 usage() { | 564 usage() { |
488 echo "usage: ${ME} update_dmg_mount_point" >& 2 | 565 echo "usage: ${ME} update_dmg_mount_point" >& 2 |
489 } | 566 } |
490 | 567 |
491 main() { | 568 main() { |
492 local update_dmg_mount_point="${1}" | 569 local update_dmg_mount_point="${1}" |
493 | 570 |
494 # Early steps are critical. Don't continue past any failure. | 571 # Early steps are critical. Don't continue past any failure. |
495 set -e | 572 set -e |
496 | 573 |
497 trap cleanup EXIT HUP INT QUIT TERM | 574 trap cleanup EXIT HUP INT QUIT TERM |
498 | 575 |
499 readonly PRODUCT_NAME="Google Chrome" | 576 readonly PRODUCT_NAME="Google Chrome" |
500 readonly APP_DIR="${PRODUCT_NAME}.app" | 577 readonly APP_DIR="${PRODUCT_NAME}.app" |
501 readonly ALTERNATE_APP_DIR="${PRODUCT_NAME} Canary.app" | 578 readonly ALTERNATE_APP_DIR="${PRODUCT_NAME} Canary.app" |
502 readonly FRAMEWORK_NAME="${PRODUCT_NAME} Framework" | 579 readonly FRAMEWORK_NAME="${PRODUCT_NAME} Framework" |
503 readonly FRAMEWORK_DIR="${FRAMEWORK_NAME}.framework" | 580 readonly FRAMEWORK_DIR="${FRAMEWORK_NAME}.framework" |
504 readonly PATCH_DIR=".patch" | 581 readonly PATCH_DIR=".patch" |
505 readonly CONTENTS_DIR="Contents" | 582 readonly CONTENTS_DIR="Contents" |
506 readonly APP_PLIST="${CONTENTS_DIR}/Info" | 583 readonly APP_PLIST="${CONTENTS_DIR}/Info" |
507 readonly VERSIONS_DIR="${CONTENTS_DIR}/Versions" | 584 readonly VERSIONS_DIR="${CONTENTS_DIR}/Versions" |
508 readonly UNROOTED_BRAND_PLIST="Library/Google/Google Chrome Brand" | 585 readonly UNROOTED_BRAND_PLIST="Library/Google/Google Chrome Brand" |
509 readonly UNROOTED_DEBUG_FILE="Library/Google/Google Chrome Updater Debug" | 586 readonly UNROOTED_DEBUG_FILE="Library/Google/Google Chrome Updater Debug" |
510 | 587 |
511 readonly APP_VERSION_KEY="CFBundleShortVersionString" | 588 readonly APP_VERSION_KEY="CFBundleShortVersionString" |
512 readonly APP_BUNDLEID_KEY="CFBundleIdentifier" | 589 readonly APP_BUNDLEID_KEY="CFBundleIdentifier" |
513 readonly KS_VERSION_KEY="KSVersion" | 590 readonly KS_VERSION_KEY="KSVersion" |
514 readonly KS_PRODUCT_KEY="KSProductID" | 591 readonly KS_PRODUCT_KEY="KSProductID" |
515 readonly KS_URL_KEY="KSUpdateURL" | 592 readonly KS_URL_KEY="KSUpdateURL" |
516 readonly KS_CHANNEL_KEY="KSChannelID" | |
517 readonly KS_BRAND_KEY="KSBrandID" | 593 readonly KS_BRAND_KEY="KSBrandID" |
518 | 594 |
519 readonly QUARANTINE_ATTR="com.apple.quarantine" | 595 readonly QUARANTINE_ATTR="com.apple.quarantine" |
520 readonly KEYCHAIN_REAUTHORIZE_DIR=".keychain_reauthorize" | 596 readonly KEYCHAIN_REAUTHORIZE_DIR=".keychain_reauthorize" |
521 | 597 |
522 # Don't use rsync -a, because -a expands to -rlptgoD. -g and -o copy owners | 598 # Don't use rsync -a, because -a expands to -rlptgoD. -g and -o copy owners |
523 # and groups, respectively, from the source, and that is undesirable in this | 599 # and groups, respectively, from the source, and that is undesirable in this |
524 # case. -D copies devices and special files; copying devices only works | 600 # case. -D copies devices and special files; copying devices only works |
525 # when running as root, so for consistency between privileged and | 601 # when running as root, so for consistency between privileged and |
526 # unprivileged operation, this option is omitted as well. | 602 # unprivileged operation, this option is omitted as well. |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
733 # Figure out where to install. | 809 # Figure out where to install. |
734 local installed_app | 810 local installed_app |
735 if ! installed_app="$(ksadmin -pP "${product_id}" | sed -Ene \ | 811 if ! installed_app="$(ksadmin -pP "${product_id}" | sed -Ene \ |
736 "s%^[[:space:]]+xc=<KSPathExistenceChecker:.* path=(/.+)>\$%\\1%p")" || | 812 "s%^[[:space:]]+xc=<KSPathExistenceChecker:.* path=(/.+)>\$%\\1%p")" || |
737 [[ -z "${installed_app}" ]]; then | 813 [[ -z "${installed_app}" ]]; then |
738 err "couldn't locate installed_app" | 814 err "couldn't locate installed_app" |
739 exit 3 | 815 exit 3 |
740 fi | 816 fi |
741 note "installed_app = ${installed_app}" | 817 note "installed_app = ${installed_app}" |
742 | 818 |
819 local want_full_installer_path="${installed_app}/.want_full_installer" | |
820 note "want_full_installer_path = ${want_full_installer_path}" | |
821 | |
743 if [[ "${installed_app:0:1}" != "/" ]] || | 822 if [[ "${installed_app:0:1}" != "/" ]] || |
744 ! [[ -d "${installed_app}" ]]; then | 823 ! [[ -d "${installed_app}" ]]; then |
745 err "installed_app must be an absolute path to a directory" | 824 err "installed_app must be an absolute path to a directory" |
746 exit 3 | 825 exit 3 |
747 fi | 826 fi |
748 | 827 |
749 # If this script is running as root, it's being driven by a system ticket. | 828 # If this script is running as root, it's being driven by a system ticket. |
750 # Otherwise, it's being driven by a user ticket. | 829 # Otherwise, it's being driven by a user ticket. |
751 local system_ticket= | 830 local system_ticket= |
752 if [[ ${EUID} -eq 0 ]]; then | 831 if [[ ${EUID} -eq 0 ]]; then |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
895 note "versioned_dir_target = ${versioned_dir_target}" | 974 note "versioned_dir_target = ${versioned_dir_target}" |
896 update_versioned_dir="${versioned_dir_target}" | 975 update_versioned_dir="${versioned_dir_target}" |
897 note "update_versioned_dir = ${update_versioned_dir}" | 976 note "update_versioned_dir = ${update_versioned_dir}" |
898 fi | 977 fi |
899 | 978 |
900 note "dirpatching versioned directory" | 979 note "dirpatching versioned directory" |
901 if ! "${dirpatcher}" "${old_versioned_dir}" \ | 980 if ! "${dirpatcher}" "${old_versioned_dir}" \ |
902 "${patch_versioned_dir}" \ | 981 "${patch_versioned_dir}" \ |
903 "${versioned_dir_target}"; then | 982 "${versioned_dir_target}"; then |
904 err "dirpatcher of versioned directory failed, status ${PIPESTATUS[0]}" | 983 err "dirpatcher of versioned directory failed, status ${PIPESTATUS[0]}" |
905 exit 12 | 984 mark_failed_patch_update "${product_id}" \ |
985 "${want_full_installer_path}" \ | |
986 "${old_ks_plist}" \ | |
987 "${old_version_app}" | |
988 exit 77 | |
906 fi | 989 fi |
907 fi | 990 fi |
908 | 991 |
909 # Copy the versioned directory. The new versioned directory should have a | 992 # Copy the versioned directory. The new versioned directory should have a |
910 # different name than any existing one, so this won't harm anything already | 993 # different name than any existing one, so this won't harm anything already |
911 # present in ${installed_versions_dir}, including the versioned directory | 994 # present in ${installed_versions_dir}, including the versioned directory |
912 # being used by any running processes. If this step is interrupted, there | 995 # being used by any running processes. If this step is interrupted, there |
913 # will be an incomplete versioned directory left behind, but it won't | 996 # will be an incomplete versioned directory left behind, but it won't |
914 # won't interfere with anything, and it will be replaced or removed during a | 997 # won't interfere with anything, and it will be replaced or removed during a |
915 # future update attempt. | 998 # future update attempt. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
949 # dirpatcher creates it. | 1032 # dirpatcher creates it. |
950 ensure_temp_dir | 1033 ensure_temp_dir |
951 update_app="${g_temp_dir}/${APP_DIR}" | 1034 update_app="${g_temp_dir}/${APP_DIR}" |
952 note "update_app = ${update_app}" | 1035 note "update_app = ${update_app}" |
953 | 1036 |
954 note "dirpatching app directory" | 1037 note "dirpatching app directory" |
955 if ! "${dirpatcher}" "${installed_app}" \ | 1038 if ! "${dirpatcher}" "${installed_app}" \ |
956 "${patch_app_dir}" \ | 1039 "${patch_app_dir}" \ |
957 "${update_app}"; then | 1040 "${update_app}"; then |
958 err "dirpatcher of app directory failed, status ${PIPESTATUS[0]}" | 1041 err "dirpatcher of app directory failed, status ${PIPESTATUS[0]}" |
959 exit 13 | 1042 mark_failed_patch_update "${product_id}" \ |
1043 "${want_full_installer_path}" \ | |
1044 "${old_ks_plist}" \ | |
1045 "${old_version_app}" | |
1046 exit 77 | |
960 fi | 1047 fi |
961 fi | 1048 fi |
962 | 1049 |
963 # See if the timestamp of what's currently on disk is newer than the | 1050 # See if the timestamp of what's currently on disk is newer than the |
964 # update's outer .app's timestamp. rsync will copy the update's timestamp | 1051 # update's outer .app's timestamp. rsync will copy the update's timestamp |
965 # over, but if that timestamp isn't as recent as what's already on disk, the | 1052 # over, but if that timestamp isn't as recent as what's already on disk, the |
966 # .app will need to be touched. | 1053 # .app will need to be touched. |
967 local needs_touch= | 1054 local needs_touch= |
968 if [[ "${installed_app}" -nt "${update_app}" ]]; then | 1055 if [[ "${installed_app}" -nt "${update_app}" ]]; then |
969 needs_touch="y" | 1056 needs_touch="y" |
(...skipping 27 matching lines...) Expand all Loading... | |
997 note "update_app = ${update_app}" | 1084 note "update_app = ${update_app}" |
998 fi | 1085 fi |
999 | 1086 |
1000 if [[ -n "${g_temp_dir}" ]]; then | 1087 if [[ -n "${g_temp_dir}" ]]; then |
1001 # The temporary directory, if any, is no longer needed. | 1088 # The temporary directory, if any, is no longer needed. |
1002 rm -rf "${g_temp_dir}" 2> /dev/null || true | 1089 rm -rf "${g_temp_dir}" 2> /dev/null || true |
1003 g_temp_dir= | 1090 g_temp_dir= |
1004 note "g_temp_dir = ${g_temp_dir}" | 1091 note "g_temp_dir = ${g_temp_dir}" |
1005 fi | 1092 fi |
1006 | 1093 |
1094 # Clean up any old .want_full_installer files from previous dirpatcher | |
1095 # failures. This is not considered a critical step, because this file | |
1096 # normally does not exist at all. | |
1097 rm -f "${want_full_installer_path}" || true | |
1098 | |
1007 # If necessary, touch the outermost .app so that it appears to the outside | 1099 # If necessary, touch the outermost .app so that it appears to the outside |
1008 # world that something was done to the bundle. This will cause | 1100 # world that something was done to the bundle. This will cause |
1009 # LaunchServices to invalidate the information it has cached about the | 1101 # LaunchServices to invalidate the information it has cached about the |
1010 # bundle even if lsregister does not run. This is not done if rsync already | 1102 # bundle even if lsregister does not run. This is not done if rsync already |
1011 # updated the timestamp to something newer than what had been on disk. This | 1103 # updated the timestamp to something newer than what had been on disk. This |
1012 # is not considered a critical step, and if it fails, this script will not | 1104 # is not considered a critical step, and if it fails, this script will not |
1013 # exit. | 1105 # exit. |
1014 if [[ -n "${needs_touch}" ]]; then | 1106 if [[ -n "${needs_touch}" ]]; then |
1015 touch -cf "${installed_app}" || true | 1107 touch -cf "${installed_app}" || true |
1016 fi | 1108 fi |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1050 fi | 1142 fi |
1051 note "update_url = ${update_url}" | 1143 note "update_url = ${update_url}" |
1052 | 1144 |
1053 # The channel ID is optional. Suppress stderr to prevent Keystone from | 1145 # The channel ID is optional. Suppress stderr to prevent Keystone from |
1054 # seeing possible error output. | 1146 # seeing possible error output. |
1055 local channel | 1147 local channel |
1056 channel="$(infoplist_read "${new_ks_plist}" \ | 1148 channel="$(infoplist_read "${new_ks_plist}" \ |
1057 "${KS_CHANNEL_KEY}" 2> /dev/null || true)" | 1149 "${KS_CHANNEL_KEY}" 2> /dev/null || true)" |
1058 note "channel = ${channel}" | 1150 note "channel = ${channel}" |
1059 | 1151 |
1152 local tag="${channel}" | |
1153 local tag_key="${KS_CHANNEL_KEY}" | |
1154 if has_32_bit_only_cpu; then | |
1155 tag="${tag}-32bit" | |
1156 tag_key="${tag_key}-32bit" | |
1157 fi | |
1158 note "tag = ${tag}" | |
1159 note "tag_key = ${tag_key}" | |
1160 | |
1060 # Make sure that the update was successful by comparing the version found in | 1161 # Make sure that the update was successful by comparing the version found in |
1061 # the update with the version now on disk. | 1162 # the update with the version now on disk. |
1062 if [[ "${new_version_ks}" != "${update_version_ks}" ]]; then | 1163 if [[ "${new_version_ks}" != "${update_version_ks}" ]]; then |
1063 err "new_version_ks and update_version_ks do not match" | 1164 err "new_version_ks and update_version_ks do not match" |
1064 exit 10 | 1165 exit 10 |
1065 fi | 1166 fi |
1066 | 1167 |
1067 # Notify LaunchServices. This is not considered a critical step, and | 1168 # Notify LaunchServices. This is not considered a critical step, and |
1068 # lsregister's exit codes shouldn't be confused with this script's own. | 1169 # lsregister's exit codes shouldn't be confused with this script's own. |
1069 # Redirect stdout to /dev/null to suppress the useless "ThrottleProcessIO: | 1170 # Redirect stdout to /dev/null to suppress the useless "ThrottleProcessIO: |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1158 local ksadmin_args=( | 1259 local ksadmin_args=( |
1159 --register | 1260 --register |
1160 --productid "${product_id}" | 1261 --productid "${product_id}" |
1161 --version "${new_version_ks}" | 1262 --version "${new_version_ks}" |
1162 --xcpath "${installed_app}" | 1263 --xcpath "${installed_app}" |
1163 --url "${update_url}" | 1264 --url "${update_url}" |
1164 ) | 1265 ) |
1165 | 1266 |
1166 if ksadmin_supports_tag; then | 1267 if ksadmin_supports_tag; then |
1167 ksadmin_args+=( | 1268 ksadmin_args+=( |
1168 --tag "${channel}" | 1269 --tag "${tag}" |
1169 ) | 1270 ) |
1170 fi | 1271 fi |
1171 | 1272 |
1172 if ksadmin_supports_tagpath_tagkey; then | 1273 if ksadmin_supports_tagpath_tagkey; then |
1173 ksadmin_args+=( | 1274 ksadmin_args+=( |
1174 --tag-path "${installed_app_plist_path}" | 1275 --tag-path "${installed_app_plist_path}" |
1175 --tag-key "${KS_CHANNEL_KEY}" | 1276 --tag-key "${tag_key}" |
1176 ) | 1277 ) |
1177 fi | 1278 fi |
1178 | 1279 |
1179 if ksadmin_supports_brandpath_brandkey; then | 1280 if ksadmin_supports_brandpath_brandkey; then |
1180 ksadmin_args+=( | 1281 ksadmin_args+=( |
1181 --brand-path "${ksadmin_brand_plist_path}" | 1282 --brand-path "${ksadmin_brand_plist_path}" |
1182 --brand-key "${ksadmin_brand_key}" | 1283 --brand-key "${ksadmin_brand_key}" |
1183 ) | 1284 ) |
1184 fi | 1285 fi |
1185 | 1286 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1405 | 1506 |
1406 # Check "less than" instead of "not equal to" in case Keystone ever changes to | 1507 # Check "less than" instead of "not equal to" in case Keystone ever changes to |
1407 # pass more arguments. | 1508 # pass more arguments. |
1408 if [[ ${#} -lt 1 ]]; then | 1509 if [[ ${#} -lt 1 ]]; then |
1409 usage | 1510 usage |
1410 exit 2 | 1511 exit 2 |
1411 fi | 1512 fi |
1412 | 1513 |
1413 main "${@}" | 1514 main "${@}" |
1414 exit ${?} | 1515 exit ${?} |
OLD | NEW |