summaryrefslogtreecommitdiffstats
path: root/chrome/installer/mac
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-23 20:32:13 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-23 20:32:13 +0000
commit8fedfee482c62619a504a59316fb07a3b0f1995a (patch)
tree2cfd15091ca9aa2cb47abd052c3221e4ac8e2f8f /chrome/installer/mac
parent2ac620e51e2f79ce9b90dbd796b247ba9ca393fd (diff)
downloadchromium_src-8fedfee482c62619a504a59316fb07a3b0f1995a.zip
chromium_src-8fedfee482c62619a504a59316fb07a3b0f1995a.tar.gz
chromium_src-8fedfee482c62619a504a59316fb07a3b0f1995a.tar.bz2
Update keystone_install.sh for 10.8, avoiding cfprefsd when reading from
Info.plist files by setting __CFPREFERENCES_AVOID_DAEMON. BUG=138199 TEST=Chrome should update on 10.8 without errors, and the new version should be reflected immediately in the Keystone ticket Review URL: https://chromiumcodereview.appspot.com/10810059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147924 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/mac')
-rwxr-xr-xchrome/installer/mac/keystone_install.sh71
1 files changed, 52 insertions, 19 deletions
diff --git a/chrome/installer/mac/keystone_install.sh b/chrome/installer/mac/keystone_install.sh
index 4dca1e2..6f038ba 100755
--- a/chrome/installer/mac/keystone_install.sh
+++ b/chrome/installer/mac/keystone_install.sh
@@ -388,6 +388,39 @@ ksadmin_supports_versionpath_versionkey() {
# return value.
}
+# Runs "defaults read" to obtain the value of a key in a property list. As
+# with "defaults read", an absolute path to a plist is supplied, without the
+# ".plist" extension.
+#
+# As of Mac OS X 10.8, defaults (and NSUserDefaults and CFPreferences)
+# normally communicates with cfprefsd to read and write plists. Changes to a
+# plist file aren't necessarily reflected immediately via this API family when
+# not made through this API family, because cfprefsd may return cached data
+# from a former on-disk version of a plist file instead of reading the current
+# version from disk. The old behavior can be restored by setting the
+# __CFPREFERENCES_AVOID_DAEMON environment variable, although extreme care
+# should be used because portions of the system that use this API family
+# normally and thus use cfprefsd and its cache will become unsynchronized with
+# the on-disk state.
+#
+# This function is provided to set __CFPREFERENCES_AVOID_DAEMON when calling
+# "defaults read" and thus avoid cfprefsd and its on-disk cache, and is
+# intended only to be used to read values from Info.plist files, which are not
+# preferences. The use of "defaults" for this purpose has always been
+# questionable, but there's no better option to interact with plists from
+# shell scripts. Definitely don't use infoplist_read to read preference
+# plists.
+#
+# This function exists because the update process delivers new copies of
+# Info.plist files to the disk behind cfprefsd's back, and if cfprefsd becomes
+# aware of the original version of the file for any reason (such as this
+# script reading values from it via "defaults read"), the new version of the
+# file will not be immediately effective or visible via cfprefsd after the
+# update is applied.
+infoplist_read() {
+ __CFPREFERENCES_AVOID_DAEMON=1 defaults read "${@}"
+}
+
usage() {
echo "usage: ${ME} update_dmg_mount_point" >& 2
}
@@ -538,8 +571,8 @@ main() {
local update_app_plist="${update_app}/${APP_PLIST}"
note "update_app_plist = ${update_app_plist}"
- if ! update_version_app="$(defaults read "${update_app_plist}" \
- "${APP_VERSION_KEY}")" ||
+ if ! update_version_app="$(infoplist_read "${update_app_plist}" \
+ "${APP_VERSION_KEY}")" ||
[[ -z "${update_version_app}" ]]; then
err "couldn't determine update_version_app"
exit 2
@@ -548,16 +581,16 @@ main() {
local update_ks_plist="${update_app_plist}"
note "update_ks_plist = ${update_ks_plist}"
- if ! update_version_ks="$(defaults read "${update_ks_plist}" \
- "${KS_VERSION_KEY}")" ||
+ if ! update_version_ks="$(infoplist_read "${update_ks_plist}" \
+ "${KS_VERSION_KEY}")" ||
[[ -z "${update_version_ks}" ]]; then
err "couldn't determine update_version_ks"
exit 2
fi
note "update_version_ks = ${update_version_ks}"
- if ! product_id="$(defaults read "${update_ks_plist}" \
- "${KS_PRODUCT_KEY}")" ||
+ if ! product_id="$(infoplist_read "${update_ks_plist}" \
+ "${KS_PRODUCT_KEY}")" ||
[[ -z "${product_id}" ]]; then
err "couldn't determine product_id"
exit 2
@@ -692,8 +725,8 @@ main() {
local installed_app_plist_path="${installed_app_plist}.plist"
note "installed_app_plist_path = ${installed_app_plist_path}"
local old_version_app
- old_version_app="$(defaults read "${installed_app_plist}" \
- "${APP_VERSION_KEY}" || true)"
+ old_version_app="$(infoplist_read "${installed_app_plist}" \
+ "${APP_VERSION_KEY}" || true)"
note "old_version_app = ${old_version_app}"
# old_version_app is not required, because it won't be present in skeleton
@@ -728,8 +761,8 @@ main() {
local old_ks_plist="${installed_app_plist}"
note "old_ks_plist = ${old_ks_plist}"
local old_brand
- old_brand="$(defaults read "${old_ks_plist}" \
- "${KS_BRAND_KEY}" 2> /dev/null ||
+ old_brand="$(infoplist_read "${old_ks_plist}" \
+ "${KS_BRAND_KEY}" 2> /dev/null ||
true)"
note "old_brand = ${old_brand}"
@@ -923,8 +956,8 @@ main() {
note "reading new values"
local new_version_app
- if ! new_version_app="$(defaults read "${installed_app_plist}" \
- "${APP_VERSION_KEY}")" ||
+ if ! new_version_app="$(infoplist_read "${installed_app_plist}" \
+ "${APP_VERSION_KEY}")" ||
[[ -z "${new_version_app}" ]]; then
err "couldn't determine new_version_app"
exit 9
@@ -938,8 +971,8 @@ main() {
note "new_ks_plist = ${new_ks_plist}"
local new_version_ks
- if ! new_version_ks="$(defaults read "${new_ks_plist}" \
- "${KS_VERSION_KEY}")" ||
+ if ! new_version_ks="$(infoplist_read "${new_ks_plist}" \
+ "${KS_VERSION_KEY}")" ||
[[ -z "${new_version_ks}" ]]; then
err "couldn't determine new_version_ks"
exit 9
@@ -947,7 +980,7 @@ main() {
note "new_version_ks = ${new_version_ks}"
local update_url
- if ! update_url="$(defaults read "${new_ks_plist}" "${KS_URL_KEY}")" ||
+ if ! update_url="$(infoplist_read "${new_ks_plist}" "${KS_URL_KEY}")" ||
[[ -z "${update_url}" ]]; then
err "couldn't determine update_url"
exit 9
@@ -957,8 +990,8 @@ main() {
# The channel ID is optional. Suppress stderr to prevent Keystone from
# seeing possible error output.
local channel
- channel="$(defaults read "${new_ks_plist}" "${KS_CHANNEL_KEY}" 2> /dev/null ||
- true)"
+ channel="$(infoplist_read "${new_ks_plist}" \
+ "${KS_CHANNEL_KEY}" 2> /dev/null || true)"
note "channel = ${channel}"
# Make sure that the update was successful by comparing the version found in
@@ -1291,8 +1324,8 @@ main() {
if [[ -z "${system_ticket}" ]]; then
local new_bundleid_app
- new_bundleid_app="$(defaults read "${installed_app_plist}" \
- "${APP_BUNDLEID_KEY}" || true)"
+ new_bundleid_app="$(infoplist_read "${installed_app_plist}" \
+ "${APP_BUNDLEID_KEY}" || true)"
note "new_bundleid_app = ${new_bundleid_app}"
local keychain_reauthorize_dir="\