OLD | NEW |
(Empty) | |
| 1 #!/bin/bash -p |
| 2 |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. |
| 6 |
| 7 # Using codesign, sign the application. After signing, the signatures on the |
| 8 # inner bundle components are verified, and the application's own signature is |
| 9 # verified. Inner bundle components are expected to be signed before this |
| 10 # script is called. See sign_versioned_dir.sh. |
| 11 |
| 12 set -eu |
| 13 |
| 14 # Environment sanitization. Set a known-safe PATH. Clear environment variables |
| 15 # that might impact the interpreter's operation. The |bash -p| invocation |
| 16 # on the #! line takes the bite out of BASH_ENV, ENV, and SHELLOPTS (among |
| 17 # other features), but clearing them here ensures that they won't impact any |
| 18 # shell scripts used as utility programs. SHELLOPTS is read-only and can't be |
| 19 # unset, only unexported. |
| 20 export PATH="/usr/bin:/bin:/usr/sbin:/sbin" |
| 21 unset BASH_ENV CDPATH ENV GLOBIGNORE IFS POSIXLY_CORRECT |
| 22 export -n SHELLOPTS |
| 23 |
| 24 ME="$(basename "${0}")" |
| 25 readonly ME |
| 26 |
| 27 if [[ ${#} -ne 3 ]]; then |
| 28 echo "usage: ${ME} app_path codesign_keychain codesign_id" >& 2 |
| 29 exit 1 |
| 30 fi |
| 31 |
| 32 app_path="${1}" |
| 33 codesign_keychain="${2}" |
| 34 codesign_id="${3}" |
| 35 |
| 36 # Use custom resource rules for the browser application. |
| 37 script_dir="$(dirname "${0}")" |
| 38 browser_app_rules="${script_dir}/app_resource_rules.plist" |
| 39 |
| 40 versioned_dir="${app_path}/Contents/Versions/32.0.1700.19" |
| 41 |
| 42 browser_app="${app_path}" |
| 43 framework="${versioned_dir}/Google Chrome Framework.framework" |
| 44 helper_app="${versioned_dir}/Google Chrome Helper.app" |
| 45 helper_eh_app="${versioned_dir}/Google Chrome Helper EH.app" |
| 46 helper_np_app="${versioned_dir}/Google Chrome Helper NP.app" |
| 47 |
| 48 requirement_string="\ |
| 49 designated => \ |
| 50 (identifier \"com.google.Chrome\" or identifier \"com.google.Chrome.canary\") \ |
| 51 and certificate leaf = H\"85cee8254216185620ddc8851c7a9fc4dfe120ef\"\ |
| 52 " |
| 53 |
| 54 codesign -s "${codesign_id}" --keychain "${codesign_keychain}" \ |
| 55 "${browser_app}" --resource-rules "${browser_app_rules}" \ |
| 56 -r="${requirement_string}" |
| 57 |
| 58 # Verify everything. Check the framework and helper apps to make sure that the |
| 59 # signatures are present and weren't altered by the signing process. |
| 60 codesign -v "${framework}" |
| 61 codesign -v "${helper_app}" |
| 62 codesign -v "${helper_eh_app}" |
| 63 codesign -v "${helper_np_app}" |
| 64 codesign -v "${browser_app}" |
OLD | NEW |