michael@0: #!/bin/sh michael@0: michael@0: # Copyright (c) 2008 The Chromium Authors. All rights reserved. michael@0: # Use of this source code is governed by a BSD-style license that can be michael@0: # found in the LICENSE file. michael@0: michael@0: # This is a wrapper for fetching values from the BRANDING files. Pass the michael@0: # value of GYP's branding variable followed by the key you want and the right michael@0: # file is checked. michael@0: # michael@0: # branding_value.sh Chromium COPYRIGHT michael@0: # branding_value.sh Chromium PRODUCT_FULLNAME michael@0: # michael@0: michael@0: set -e michael@0: michael@0: if [ $# -ne 2 ] ; then michael@0: echo "error: expect two arguments, branding and key" >&2 michael@0: exit 1 michael@0: fi michael@0: michael@0: BUILD_BRANDING=$1 michael@0: THE_KEY=$2 michael@0: michael@0: pushd $(dirname "${0}") > /dev/null michael@0: BUILD_DIR=$(pwd) michael@0: popd > /dev/null michael@0: michael@0: TOP="${BUILD_DIR}/.." michael@0: michael@0: case ${BUILD_BRANDING} in michael@0: Chromium) michael@0: BRANDING_FILE="${TOP}/chrome/app/theme/chromium/BRANDING" michael@0: ;; michael@0: Chrome) michael@0: BRANDING_FILE="${TOP}/chrome/app/theme/google_chrome/BRANDING" michael@0: ;; michael@0: *) michael@0: echo "error: unknown branding: ${BUILD_BRANDING}" >&2 michael@0: exit 1 michael@0: ;; michael@0: esac michael@0: michael@0: BRANDING_VALUE=$(sed -n -e "s/^${THE_KEY}=\(.*\)\$/\1/p" "${BRANDING_FILE}") michael@0: michael@0: if [ -z "${BRANDING_VALUE}" ] ; then michael@0: echo "error: failed to find key '${THE_KEY}'" >&2 michael@0: exit 1 michael@0: fi michael@0: michael@0: echo "${BRANDING_VALUE}"