branding_value.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/sh
  2. # Copyright (c) 2008 The Chromium Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. # This is a wrapper for fetching values from the BRANDING files. Pass the
  6. # value of GYP's branding variable followed by the key you want and the right
  7. # file is checked.
  8. #
  9. # branding_value.sh Chromium COPYRIGHT
  10. # branding_value.sh Chromium PRODUCT_FULLNAME
  11. #
  12. set -e
  13. if [ $# -ne 2 ] ; then
  14. echo "error: expect two arguments, branding and key" >&2
  15. exit 1
  16. fi
  17. BUILD_BRANDING=$1
  18. THE_KEY=$2
  19. pushd $(dirname "${0}") > /dev/null
  20. BUILD_DIR=$(pwd)
  21. popd > /dev/null
  22. TOP="${BUILD_DIR}/.."
  23. case ${BUILD_BRANDING} in
  24. Chromium)
  25. BRANDING_FILE="${TOP}/chrome/app/theme/chromium/BRANDING"
  26. ;;
  27. Chrome)
  28. BRANDING_FILE="${TOP}/chrome/app/theme/google_chrome/BRANDING"
  29. ;;
  30. *)
  31. echo "error: unknown branding: ${BUILD_BRANDING}" >&2
  32. exit 1
  33. ;;
  34. esac
  35. BRANDING_VALUE=$(sed -n -e "s/^${THE_KEY}=\(.*\)\$/\1/p" "${BRANDING_FILE}")
  36. if [ -z "${BRANDING_VALUE}" ] ; then
  37. echo "error: failed to find key '${THE_KEY}'" >&2
  38. exit 1
  39. fi
  40. echo "${BRANDING_VALUE}"