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 can be used to convey special meaning to Keystone: |
36 # convey special meaning to Keystone: | |
37 # 66 (unused) success, request reboot | 34 # 66 (unused) success, request reboot |
38 # 77 (unused) try installation again later | 35 # 77 try installation again later |
39 | 36 |
40 set -eu | 37 set -eu |
41 | 38 |
42 # http://b/2290916: Keystone runs the installation with a restrictive PATH | 39 # http://b/2290916: Keystone runs the installation with a restrictive PATH |
43 # that only includes the directory containing ksadmin, /bin, and /usr/bin. It | 40 # 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 | 41 # 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 | 42 # /usr/sbin, and it's conceivable that it might want to use other tools in an |
46 # sbin directory. Adjust the path accordingly. | 43 # sbin directory. Adjust the path accordingly. |
47 export PATH="${PATH}:/sbin:/usr/sbin" | 44 export PATH="${PATH}:/sbin:/usr/sbin" |
48 | 45 |
49 # Environment sanitization. Clear environment variables that might impact the | 46 # Environment sanitization. Clear environment variables that might impact the |
50 # interpreter's operation. The |bash -p| invocation on the #! line takes the | 47 # 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 | 48 # 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 | 49 # 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 | 50 # utility programs. SHELLOPTS is read-only and can't be unset, only |
54 # unexported. | 51 # unexported. |
55 unset BASH_ENV CDPATH ENV GLOBIGNORE IFS POSIXLY_CORRECT | 52 unset BASH_ENV CDPATH ENV GLOBIGNORE IFS POSIXLY_CORRECT |
56 export -n SHELLOPTS | 53 export -n SHELLOPTS |
57 | 54 |
58 set -o pipefail | 55 set -o pipefail |
59 shopt -s nullglob | 56 shopt -s nullglob |
60 | 57 |
61 ME="$(basename "${0}")" | 58 ME="$(basename "${0}")" |
62 readonly ME | 59 readonly ME |
63 | 60 |
61 readonly KS_CHANNEL_KEY="KSChannelID" | |
62 | |
64 # Workaround for http://code.google.com/p/chromium/issues/detail?id=83180#c3 | 63 # 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. | 64 # In bash 4.0, "declare VAR" no longer initializes VAR if not already set. |
66 : ${GOOGLE_CHROME_UPDATER_DEBUG:=} | 65 : ${GOOGLE_CHROME_UPDATER_DEBUG:=} |
67 err() { | 66 err() { |
68 local error="${1}" | 67 local error="${1}" |
69 | 68 |
70 local id= | 69 local id= |
71 if [[ -n "${GOOGLE_CHROME_UPDATER_DEBUG}" ]]; then | 70 if [[ -n "${GOOGLE_CHROME_UPDATER_DEBUG}" ]]; then |
72 id=": ${$} $(date "+%Y-%m-%d %H:%M:%S %z")" | 71 id=": ${$} $(date "+%Y-%m-%d %H:%M:%S %z")" |
73 fi | 72 fi |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
444 | 443 |
445 # Returns 0 (true) if ksadmin supports --version-path and --version-key. | 444 # Returns 0 (true) if ksadmin supports --version-path and --version-key. |
446 ksadmin_supports_versionpath_versionkey() { | 445 ksadmin_supports_versionpath_versionkey() { |
447 # --version-path and --version-key were introduced in Keystone 1.0.9.2318. | 446 # --version-path and --version-key were introduced in Keystone 1.0.9.2318. |
448 is_ksadmin_version_ge 1.0.9.2318 | 447 is_ksadmin_version_ge 1.0.9.2318 |
449 | 448 |
450 # The return value of is_ksadmin_version_ge is used as this function's | 449 # The return value of is_ksadmin_version_ge is used as this function's |
451 # return value. | 450 # return value. |
452 } | 451 } |
453 | 452 |
453 has_32_bit_only_cpu() { | |
454 local cpu_64_bit_capable="$(sysctl -n hw.cpu64bit_capable 2>/dev/null)" | |
455 [[ -z "${cpu_64_bit_capable}" || "${cpu_64_bit_capable}" -eq 0 ]] | |
456 | |
457 # The return value of the comparison is used as this function's return | |
458 # value. | |
459 } | |
460 | |
454 # Runs "defaults read" to obtain the value of a key in a property list. As | 461 # 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 | 462 # with "defaults read", an absolute path to a plist is supplied, without the |
456 # ".plist" extension. | 463 # ".plist" extension. |
457 # | 464 # |
458 # As of Mac OS X 10.8, defaults (and NSUserDefaults and CFPreferences) | 465 # 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 | 466 # 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 | 467 # 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 | 468 # 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 | 469 # 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 | 470 # 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 | 484 # 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 | 485 # 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 | 486 # 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 | 487 # 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 | 488 # file will not be immediately effective or visible via cfprefsd after the |
482 # update is applied. | 489 # update is applied. |
483 infoplist_read() { | 490 infoplist_read() { |
484 __CFPREFERENCES_AVOID_DAEMON=1 defaults read "${@}" | 491 __CFPREFERENCES_AVOID_DAEMON=1 defaults read "${@}" |
485 } | 492 } |
486 | 493 |
494 # When a patch update fails because the old installed copy doesn't match the | |
495 # expected state, mark_failed_patch_update updates the Keystone ticket by | |
496 # adding "-full" to the tag. The server will see this on a subsequent update | |
497 # attempt and will provide a full update (as opposed to a patch) to the | |
498 # client. | |
499 # | |
500 # Even if mark_failed_patch_update fails to modify the tag, the user will | |
501 # eventually be updated. Patch updates are only provided for successive | |
502 # releases on a particular channel, to update version o to version o+1. If a | |
503 # patch update fails in this case, eventually version o+2 will be released, | |
504 # and no patch update will exist to update o to o+2, so the server will | |
505 # provide a full update package. | |
506 mark_failed_patch_update() { | |
507 local product_id="${1}" | |
508 local want_full_installer_path="${2}" | |
509 local old_ks_plist="${3}" | |
510 local old_version_app="${4}" | |
511 | |
512 set +e | |
513 | |
514 note "marking failed patch update" | |
515 | |
516 local channel | |
517 channel="$(infoplist_read "${old_ks_plist}" "${KS_CHANNEL_KEY}" 2> /dev/null)" | |
518 | |
519 local tag="${channel}" | |
520 local tag_key="${KS_CHANNEL_KEY}" | |
521 if has_32_bit_only_cpu; then | |
522 tag="${tag}-32bit" | |
523 tag_key="${tag_key}-32bit" | |
524 fi | |
525 | |
526 tag="${tag}-full" | |
527 tag_key="${tag_key}-full" | |
528 | |
529 note "tag = ${tag}" | |
530 note "tag_key = ${tag_key}" | |
531 | |
532 # ${old_ks_plist}, used for --tag-path, is the Info.plist for the old | |
Mark Mentovai
2014/01/03 16:46:41
This is the newly-added section.
| |
533 # version of Chrome. It may not contain the keys for the "-full" tag suffix. | |
534 # If it doesn't, just bail out without marking the patch update as failed. | |
535 local read_tag="$(infoplist_read "${old_ks_plist}" "${tag_key}" 2> /dev/null)" | |
536 note "read_tag = ${read_tag}" | |
537 if [[ -z "${read_tag}" ]]; then | |
538 note "couldn't mark failed patch update" | |
539 return 0 | |
540 fi | |
541 | |
542 # Chrome can't easily read its Keystone ticket prior to registration, and | |
543 # when Chrome registers with Keystone, it obliterates old tag values in its | |
544 # ticket. Therefore, an alternative mechanism is provided to signal to | |
545 # Chrome that a full installer is desired. If the .want_full_installer file | |
546 # is present and it contains Chrome's current version number, Chrome will | |
547 # include "-full" in its tag when it registers with Keystone. This allows | |
548 # "-full" to persist in the tag even after Chrome is relaunched, which on a | |
549 # user ticket, triggers a re-registration. | |
550 echo "${old_version_app}" > "${want_full_installer_path}" | |
551 chmod 644 "${want_full_installer_path}" | |
552 | |
553 local old_ks_plist_path="${old_ks_plist}.plist" | |
554 | |
555 # Using ksadmin without --register only updates specified values in the | |
556 # ticket, without changing other existing values. | |
557 local ksadmin_args=( | |
558 --productid "${product_id}" | |
559 ) | |
560 | |
561 if ksadmin_supports_tag; then | |
562 ksadmin_args+=( | |
563 --tag "${tag}" | |
564 ) | |
565 fi | |
566 | |
567 if ksadmin_supports_tagpath_tagkey; then | |
568 ksadmin_args+=( | |
569 --tag-path "${old_ks_plist_path}" | |
570 --tag-key "${tag_key}" | |
571 ) | |
572 fi | |
573 | |
574 note "ksadmin_args = ${ksadmin_args[*]}" | |
575 | |
576 if ! ksadmin "${ksadmin_args[@]}"; then | |
577 err "ksadmin failed" | |
578 fi | |
579 | |
580 note "marked failed patch update" | |
581 | |
582 set -e | |
583 } | |
584 | |
487 usage() { | 585 usage() { |
488 echo "usage: ${ME} update_dmg_mount_point" >& 2 | 586 echo "usage: ${ME} update_dmg_mount_point" >& 2 |
489 } | 587 } |
490 | 588 |
491 main() { | 589 main() { |
492 local update_dmg_mount_point="${1}" | 590 local update_dmg_mount_point="${1}" |
493 | 591 |
494 # Early steps are critical. Don't continue past any failure. | 592 # Early steps are critical. Don't continue past any failure. |
495 set -e | 593 set -e |
496 | 594 |
497 trap cleanup EXIT HUP INT QUIT TERM | 595 trap cleanup EXIT HUP INT QUIT TERM |
498 | 596 |
499 readonly PRODUCT_NAME="Google Chrome" | 597 readonly PRODUCT_NAME="Google Chrome" |
500 readonly APP_DIR="${PRODUCT_NAME}.app" | 598 readonly APP_DIR="${PRODUCT_NAME}.app" |
501 readonly ALTERNATE_APP_DIR="${PRODUCT_NAME} Canary.app" | 599 readonly ALTERNATE_APP_DIR="${PRODUCT_NAME} Canary.app" |
502 readonly FRAMEWORK_NAME="${PRODUCT_NAME} Framework" | 600 readonly FRAMEWORK_NAME="${PRODUCT_NAME} Framework" |
503 readonly FRAMEWORK_DIR="${FRAMEWORK_NAME}.framework" | 601 readonly FRAMEWORK_DIR="${FRAMEWORK_NAME}.framework" |
504 readonly PATCH_DIR=".patch" | 602 readonly PATCH_DIR=".patch" |
505 readonly CONTENTS_DIR="Contents" | 603 readonly CONTENTS_DIR="Contents" |
506 readonly APP_PLIST="${CONTENTS_DIR}/Info" | 604 readonly APP_PLIST="${CONTENTS_DIR}/Info" |
507 readonly VERSIONS_DIR="${CONTENTS_DIR}/Versions" | 605 readonly VERSIONS_DIR="${CONTENTS_DIR}/Versions" |
508 readonly UNROOTED_BRAND_PLIST="Library/Google/Google Chrome Brand" | 606 readonly UNROOTED_BRAND_PLIST="Library/Google/Google Chrome Brand" |
509 readonly UNROOTED_DEBUG_FILE="Library/Google/Google Chrome Updater Debug" | 607 readonly UNROOTED_DEBUG_FILE="Library/Google/Google Chrome Updater Debug" |
510 | 608 |
511 readonly APP_VERSION_KEY="CFBundleShortVersionString" | 609 readonly APP_VERSION_KEY="CFBundleShortVersionString" |
512 readonly APP_BUNDLEID_KEY="CFBundleIdentifier" | 610 readonly APP_BUNDLEID_KEY="CFBundleIdentifier" |
513 readonly KS_VERSION_KEY="KSVersion" | 611 readonly KS_VERSION_KEY="KSVersion" |
514 readonly KS_PRODUCT_KEY="KSProductID" | 612 readonly KS_PRODUCT_KEY="KSProductID" |
515 readonly KS_URL_KEY="KSUpdateURL" | 613 readonly KS_URL_KEY="KSUpdateURL" |
516 readonly KS_CHANNEL_KEY="KSChannelID" | |
517 readonly KS_BRAND_KEY="KSBrandID" | 614 readonly KS_BRAND_KEY="KSBrandID" |
518 | 615 |
519 readonly QUARANTINE_ATTR="com.apple.quarantine" | 616 readonly QUARANTINE_ATTR="com.apple.quarantine" |
520 readonly KEYCHAIN_REAUTHORIZE_DIR=".keychain_reauthorize" | 617 readonly KEYCHAIN_REAUTHORIZE_DIR=".keychain_reauthorize" |
521 | 618 |
522 # Don't use rsync -a, because -a expands to -rlptgoD. -g and -o copy owners | 619 # 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 | 620 # and groups, respectively, from the source, and that is undesirable in this |
524 # case. -D copies devices and special files; copying devices only works | 621 # case. -D copies devices and special files; copying devices only works |
525 # when running as root, so for consistency between privileged and | 622 # when running as root, so for consistency between privileged and |
526 # unprivileged operation, this option is omitted as well. | 623 # 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. | 830 # Figure out where to install. |
734 local installed_app | 831 local installed_app |
735 if ! installed_app="$(ksadmin -pP "${product_id}" | sed -Ene \ | 832 if ! installed_app="$(ksadmin -pP "${product_id}" | sed -Ene \ |
736 "s%^[[:space:]]+xc=<KSPathExistenceChecker:.* path=(/.+)>\$%\\1%p")" || | 833 "s%^[[:space:]]+xc=<KSPathExistenceChecker:.* path=(/.+)>\$%\\1%p")" || |
737 [[ -z "${installed_app}" ]]; then | 834 [[ -z "${installed_app}" ]]; then |
738 err "couldn't locate installed_app" | 835 err "couldn't locate installed_app" |
739 exit 3 | 836 exit 3 |
740 fi | 837 fi |
741 note "installed_app = ${installed_app}" | 838 note "installed_app = ${installed_app}" |
742 | 839 |
840 local want_full_installer_path="${installed_app}/.want_full_installer" | |
841 note "want_full_installer_path = ${want_full_installer_path}" | |
842 | |
743 if [[ "${installed_app:0:1}" != "/" ]] || | 843 if [[ "${installed_app:0:1}" != "/" ]] || |
744 ! [[ -d "${installed_app}" ]]; then | 844 ! [[ -d "${installed_app}" ]]; then |
745 err "installed_app must be an absolute path to a directory" | 845 err "installed_app must be an absolute path to a directory" |
746 exit 3 | 846 exit 3 |
747 fi | 847 fi |
748 | 848 |
749 # If this script is running as root, it's being driven by a system ticket. | 849 # 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. | 850 # Otherwise, it's being driven by a user ticket. |
751 local system_ticket= | 851 local system_ticket= |
752 if [[ ${EUID} -eq 0 ]]; then | 852 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}" | 995 note "versioned_dir_target = ${versioned_dir_target}" |
896 update_versioned_dir="${versioned_dir_target}" | 996 update_versioned_dir="${versioned_dir_target}" |
897 note "update_versioned_dir = ${update_versioned_dir}" | 997 note "update_versioned_dir = ${update_versioned_dir}" |
898 fi | 998 fi |
899 | 999 |
900 note "dirpatching versioned directory" | 1000 note "dirpatching versioned directory" |
901 if ! "${dirpatcher}" "${old_versioned_dir}" \ | 1001 if ! "${dirpatcher}" "${old_versioned_dir}" \ |
902 "${patch_versioned_dir}" \ | 1002 "${patch_versioned_dir}" \ |
903 "${versioned_dir_target}"; then | 1003 "${versioned_dir_target}"; then |
904 err "dirpatcher of versioned directory failed, status ${PIPESTATUS[0]}" | 1004 err "dirpatcher of versioned directory failed, status ${PIPESTATUS[0]}" |
905 exit 12 | 1005 mark_failed_patch_update "${product_id}" \ |
1006 "${want_full_installer_path}" \ | |
1007 "${old_ks_plist}" \ | |
1008 "${old_version_app}" | |
1009 exit 77 | |
906 fi | 1010 fi |
907 fi | 1011 fi |
908 | 1012 |
909 # Copy the versioned directory. The new versioned directory should have a | 1013 # 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 | 1014 # different name than any existing one, so this won't harm anything already |
911 # present in ${installed_versions_dir}, including the versioned directory | 1015 # present in ${installed_versions_dir}, including the versioned directory |
912 # being used by any running processes. If this step is interrupted, there | 1016 # 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 | 1017 # 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 | 1018 # won't interfere with anything, and it will be replaced or removed during a |
915 # future update attempt. | 1019 # future update attempt. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
949 # dirpatcher creates it. | 1053 # dirpatcher creates it. |
950 ensure_temp_dir | 1054 ensure_temp_dir |
951 update_app="${g_temp_dir}/${APP_DIR}" | 1055 update_app="${g_temp_dir}/${APP_DIR}" |
952 note "update_app = ${update_app}" | 1056 note "update_app = ${update_app}" |
953 | 1057 |
954 note "dirpatching app directory" | 1058 note "dirpatching app directory" |
955 if ! "${dirpatcher}" "${installed_app}" \ | 1059 if ! "${dirpatcher}" "${installed_app}" \ |
956 "${patch_app_dir}" \ | 1060 "${patch_app_dir}" \ |
957 "${update_app}"; then | 1061 "${update_app}"; then |
958 err "dirpatcher of app directory failed, status ${PIPESTATUS[0]}" | 1062 err "dirpatcher of app directory failed, status ${PIPESTATUS[0]}" |
959 exit 13 | 1063 mark_failed_patch_update "${product_id}" \ |
1064 "${want_full_installer_path}" \ | |
1065 "${old_ks_plist}" \ | |
1066 "${old_version_app}" | |
1067 exit 77 | |
960 fi | 1068 fi |
961 fi | 1069 fi |
962 | 1070 |
963 # See if the timestamp of what's currently on disk is newer than the | 1071 # 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 | 1072 # 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 | 1073 # over, but if that timestamp isn't as recent as what's already on disk, the |
966 # .app will need to be touched. | 1074 # .app will need to be touched. |
967 local needs_touch= | 1075 local needs_touch= |
968 if [[ "${installed_app}" -nt "${update_app}" ]]; then | 1076 if [[ "${installed_app}" -nt "${update_app}" ]]; then |
969 needs_touch="y" | 1077 needs_touch="y" |
(...skipping 27 matching lines...) Expand all Loading... | |
997 note "update_app = ${update_app}" | 1105 note "update_app = ${update_app}" |
998 fi | 1106 fi |
999 | 1107 |
1000 if [[ -n "${g_temp_dir}" ]]; then | 1108 if [[ -n "${g_temp_dir}" ]]; then |
1001 # The temporary directory, if any, is no longer needed. | 1109 # The temporary directory, if any, is no longer needed. |
1002 rm -rf "${g_temp_dir}" 2> /dev/null || true | 1110 rm -rf "${g_temp_dir}" 2> /dev/null || true |
1003 g_temp_dir= | 1111 g_temp_dir= |
1004 note "g_temp_dir = ${g_temp_dir}" | 1112 note "g_temp_dir = ${g_temp_dir}" |
1005 fi | 1113 fi |
1006 | 1114 |
1115 # Clean up any old .want_full_installer files from previous dirpatcher | |
1116 # failures. This is not considered a critical step, because this file | |
1117 # normally does not exist at all. | |
1118 rm -f "${want_full_installer_path}" || true | |
1119 | |
1007 # If necessary, touch the outermost .app so that it appears to the outside | 1120 # 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 | 1121 # world that something was done to the bundle. This will cause |
1009 # LaunchServices to invalidate the information it has cached about the | 1122 # 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 | 1123 # 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 | 1124 # 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 | 1125 # is not considered a critical step, and if it fails, this script will not |
1013 # exit. | 1126 # exit. |
1014 if [[ -n "${needs_touch}" ]]; then | 1127 if [[ -n "${needs_touch}" ]]; then |
1015 touch -cf "${installed_app}" || true | 1128 touch -cf "${installed_app}" || true |
1016 fi | 1129 fi |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1050 fi | 1163 fi |
1051 note "update_url = ${update_url}" | 1164 note "update_url = ${update_url}" |
1052 | 1165 |
1053 # The channel ID is optional. Suppress stderr to prevent Keystone from | 1166 # The channel ID is optional. Suppress stderr to prevent Keystone from |
1054 # seeing possible error output. | 1167 # seeing possible error output. |
1055 local channel | 1168 local channel |
1056 channel="$(infoplist_read "${new_ks_plist}" \ | 1169 channel="$(infoplist_read "${new_ks_plist}" \ |
1057 "${KS_CHANNEL_KEY}" 2> /dev/null || true)" | 1170 "${KS_CHANNEL_KEY}" 2> /dev/null || true)" |
1058 note "channel = ${channel}" | 1171 note "channel = ${channel}" |
1059 | 1172 |
1173 local tag="${channel}" | |
1174 local tag_key="${KS_CHANNEL_KEY}" | |
1175 if has_32_bit_only_cpu; then | |
1176 tag="${tag}-32bit" | |
1177 tag_key="${tag_key}-32bit" | |
1178 fi | |
1179 note "tag = ${tag}" | |
1180 note "tag_key = ${tag_key}" | |
1181 | |
1060 # Make sure that the update was successful by comparing the version found in | 1182 # Make sure that the update was successful by comparing the version found in |
1061 # the update with the version now on disk. | 1183 # the update with the version now on disk. |
1062 if [[ "${new_version_ks}" != "${update_version_ks}" ]]; then | 1184 if [[ "${new_version_ks}" != "${update_version_ks}" ]]; then |
1063 err "new_version_ks and update_version_ks do not match" | 1185 err "new_version_ks and update_version_ks do not match" |
1064 exit 10 | 1186 exit 10 |
1065 fi | 1187 fi |
1066 | 1188 |
1067 # Notify LaunchServices. This is not considered a critical step, and | 1189 # Notify LaunchServices. This is not considered a critical step, and |
1068 # lsregister's exit codes shouldn't be confused with this script's own. | 1190 # lsregister's exit codes shouldn't be confused with this script's own. |
1069 # Redirect stdout to /dev/null to suppress the useless "ThrottleProcessIO: | 1191 # 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=( | 1280 local ksadmin_args=( |
1159 --register | 1281 --register |
1160 --productid "${product_id}" | 1282 --productid "${product_id}" |
1161 --version "${new_version_ks}" | 1283 --version "${new_version_ks}" |
1162 --xcpath "${installed_app}" | 1284 --xcpath "${installed_app}" |
1163 --url "${update_url}" | 1285 --url "${update_url}" |
1164 ) | 1286 ) |
1165 | 1287 |
1166 if ksadmin_supports_tag; then | 1288 if ksadmin_supports_tag; then |
1167 ksadmin_args+=( | 1289 ksadmin_args+=( |
1168 --tag "${channel}" | 1290 --tag "${tag}" |
1169 ) | 1291 ) |
1170 fi | 1292 fi |
1171 | 1293 |
1172 if ksadmin_supports_tagpath_tagkey; then | 1294 if ksadmin_supports_tagpath_tagkey; then |
1173 ksadmin_args+=( | 1295 ksadmin_args+=( |
1174 --tag-path "${installed_app_plist_path}" | 1296 --tag-path "${installed_app_plist_path}" |
1175 --tag-key "${KS_CHANNEL_KEY}" | 1297 --tag-key "${tag_key}" |
1176 ) | 1298 ) |
1177 fi | 1299 fi |
1178 | 1300 |
1179 if ksadmin_supports_brandpath_brandkey; then | 1301 if ksadmin_supports_brandpath_brandkey; then |
1180 ksadmin_args+=( | 1302 ksadmin_args+=( |
1181 --brand-path "${ksadmin_brand_plist_path}" | 1303 --brand-path "${ksadmin_brand_plist_path}" |
1182 --brand-key "${ksadmin_brand_key}" | 1304 --brand-key "${ksadmin_brand_key}" |
1183 ) | 1305 ) |
1184 fi | 1306 fi |
1185 | 1307 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1405 | 1527 |
1406 # Check "less than" instead of "not equal to" in case Keystone ever changes to | 1528 # Check "less than" instead of "not equal to" in case Keystone ever changes to |
1407 # pass more arguments. | 1529 # pass more arguments. |
1408 if [[ ${#} -lt 1 ]]; then | 1530 if [[ ${#} -lt 1 ]]; then |
1409 usage | 1531 usage |
1410 exit 2 | 1532 exit 2 |
1411 fi | 1533 fi |
1412 | 1534 |
1413 main "${@}" | 1535 main "${@}" |
1414 exit ${?} | 1536 exit ${?} |
OLD | NEW |