summaryrefslogtreecommitdiffstats
path: root/build/branding_value.sh
diff options
context:
space:
mode:
authorthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-19 14:10:09 +0000
committerthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-19 14:10:09 +0000
commit3c4beb226d1f279685d82861a062b599401cd2a9 (patch)
tree6139b36ab4eff4a66590a7a4ad5990ba9ac153b3 /build/branding_value.sh
parent136140cbfa6adc9caed9692eb664ff9c4a73482d (diff)
downloadchromium_src-3c4beb226d1f279685d82861a062b599401cd2a9.zip
chromium_src-3c4beb226d1f279685d82861a062b599401cd2a9.tar.gz
chromium_src-3c4beb226d1f279685d82861a062b599401cd2a9.tar.bz2
Adding a general script to fetch values from the BRANDING files.
Update the scripts to fetch values from the BRANDING files instead of hardcoding the values. Review URL: http://codereview.chromium.org/113555 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16372 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/branding_value.sh')
-rwxr-xr-xbuild/branding_value.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/build/branding_value.sh b/build/branding_value.sh
new file mode 100755
index 0000000..9fcb550
--- /dev/null
+++ b/build/branding_value.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# Copyright (c) 2008 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This is a wrapper for fetching values from the BRANDING files. Pass the
+# value of GYP's branding variable followed by the key you want and the right
+# file is checked.
+#
+# branding_value.sh Chromium COPYRIGHT
+# branding_value.sh Chromium PRODUCT_FULLNAME
+#
+
+set -e
+
+if [ $# -ne 2 ] ; then
+ echo "error: expect two arguments, branding and key" >&2
+ exit 1
+fi
+
+BUILD_BRANDING=$1
+THE_KEY=$2
+
+pushd $(dirname "${0}") > /dev/null
+BUILD_DIR=$(pwd)
+popd > /dev/null
+
+TOP="${BUILD_DIR}/.."
+
+case ${BUILD_BRANDING} in
+ Chromium)
+ BRANDING_FILE="${TOP}/chrome/app/theme/chromium/BRANDING"
+ ;;
+ Chrome)
+ BRANDING_FILE="${TOP}/chrome/app/theme/google_chrome/BRANDING"
+ ;;
+ *)
+ echo "error: unknown branding: ${BUILD_BRANDING}" >&2
+ exit 1
+ ;;
+esac
+
+BRANDING_VALUE=$(sed -n -e "s/^${THE_KEY}=\(.*\)\$/\1/p" "${BRANDING_FILE}")
+
+if [ -z "${BRANDING_VALUE}" ] ; then
+ echo "error: failed to find key '${THE_KEY}'" >&2
+ exit 1
+fi
+
+echo "${BRANDING_VALUE}"