summaryrefslogtreecommitdiffstats
path: root/chrome/tools/build
diff options
context:
space:
mode:
authorthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-27 12:53:12 +0000
committerthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-27 12:53:12 +0000
commitfc854db57337e41cd7b18cf5965b5a9b111d4416 (patch)
treef3ef2121ee34e7b4a423359ef26aaa3e6032d412 /chrome/tools/build
parent27d81c2f3f2aeec7f418fdd4341f4f9bd82292e8 (diff)
downloadchromium_src-fc854db57337e41cd7b18cf5965b5a9b111d4416.zip
chromium_src-fc854db57337e41cd7b18cf5965b5a9b111d4416.tar.gz
chromium_src-fc854db57337e41cd7b18cf5965b5a9b111d4416.tar.bz2
[Mac] Brand code support on the Mac:
- During keystone registration pull in the brand file at user to system level. - Clean up old user level brand files after moving to a system ticket. - During keystone ticket promotion, use the pref flight script to copy the brand information out to the system level. - When updating check to see if the user had manually updated the app and gotten a new brand code, if so, migrate that code into the right location. BUG=39131 TEST=email from tvl to QA with details. Review URL: http://codereview.chromium.org/1687012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45687 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/tools/build')
-rwxr-xr-xchrome/tools/build/mac/keystone_install.sh64
1 files changed, 63 insertions, 1 deletions
diff --git a/chrome/tools/build/mac/keystone_install.sh b/chrome/tools/build/mac/keystone_install.sh
index 67e3a78..73f0920 100755
--- a/chrome/tools/build/mac/keystone_install.sh
+++ b/chrome/tools/build/mac/keystone_install.sh
@@ -196,6 +196,17 @@ function ksadmin_supports_tagpath_tagkey() {
# return value.
}
+# Returns 0 (true) if ksadmin supports --tag-path, --tag-key, --brand-path,
+# and --brand-key.
+function ksadmin_supports_brandpath_brandkey() {
+ # --brand-path and --brand-key were introduced in Keystone 1.0.8.1620.
+ # --tag-path and --tag-key are already supported if the brand arguments are
+ # also supported.
+ is_ksadmin_version_ge 1.0.8.1620
+ # The return value of is_ksadmin_version_ge is used as this function's
+ # return value.
+}
+
# The argument should be the disk image path. Make sure it exists.
if [ $# -lt 1 ] || [ ! -d "${1}" ]; then
exit 2
@@ -322,6 +333,11 @@ if [ ${EUID} -ne 0 ] ; then
set -e
fi
+# Collect the current app brand, it will be use later.
+BRAND_ID_KEY=KSBrandID
+APP_BRAND=$(defaults read "${DEST}/Contents/Info" "${BRAND_ID_KEY}" 2>/dev/null ||
+ true)
+
# Don't use rsync -a, because -a expands to -rlptgoD. -g and -o copy owners
# and groups, respectively, from the source, and that is undesirable in this
# case. -D copies devices and special files; copying devices only works
@@ -420,8 +436,54 @@ fi
# beforehand.
ksadmin_version >& /dev/null || true
+# The brand information is stored differently depending on whether this is
+# running for a system or user ticket.
+BRAND_PATH_PLIST=
+SET_BRAND_FILE_ACCESS=no
+if [ ${EUID} -ne 0 ] ; then
+ # Using a user level ticket.
+ BRAND_PATH_PLIST=~/"Library/Google/Google Chrome Brand"
+else
+ # Using a system level ticket.
+ BRAND_PATH_PLIST="/Library/Google/Google Chrome Brand"
+ SET_BRAND_FILE_ACCESS=yes
+fi
+# If the user manually updated their copy of Chrome, there might be new brand
+# information in the app bundle, and that needs to be copied out into the
+# file Keystone looks at.
+BRAND_PATH="${BRAND_PATH_PLIST}.plist"
+if [ -n "${APP_BRAND}" ] ; then
+ BRAND_PATH_DIR=$(dirname "${BRAND_PATH}")
+ if [ ! -e "${BRAND_PATH_DIR}" ] ; then
+ mkdir -p "${BRAND_PATH_DIR}"
+ fi
+ defaults write "${BRAND_PATH_PLIST}" "${BRAND_ID_KEY}" -string "${APP_BRAND}"
+ if [ "${SET_BRAND_FILE_ACCESS}" = "yes" ] ; then
+ chown "root:wheel" "${BRAND_PATH}" >& /dev/null
+ chmod "a+r,u+w,go-w" "${BRAND_PATH}" >& /dev/null
+ fi
+fi
+# Confirm that the brand file exists (it is optional)
+if [ ! -f "${BRAND_PATH}" ] ; then
+ BRAND_PATH=
+ # ksadmin reports an error if brand-path is cleared but brand-key still has a
+ # value, so if there is no path, clear the key also.
+ BRAND_ID_KEY=
+fi
+
# Notify Keystone.
-if ksadmin_supports_tagpath_tagkey ; then
+if ksadmin_supports_brandpath_brandkey ; then
+ ksadmin --register \
+ -P "${PRODUCT_ID}" \
+ --version "${NEW_VERSION_KS}" \
+ --xcpath "${DEST}" \
+ --url "${URL}" \
+ --tag "${CHANNEL_ID}" \
+ --tag-path "${DEST}/Contents/Info.plist" \
+ --tag-key "${CHANNEL_ID_KEY}" \
+ --brand-path "${BRAND_PATH}" \
+ --brand-key "${BRAND_ID_KEY}" || exit 11
+elif ksadmin_supports_tagpath_tagkey ; then
ksadmin --register \
-P "${PRODUCT_ID}" \
--version "${NEW_VERSION_KS}" \