Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Side by Side Diff: chrome/installer/mac/sign_app.sh.in

Issue 2749014: Split sign.sh into two pieces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/installer/mac/sign.sh.in ('k') | chrome/installer/mac/sign_versioned_dir.sh.in » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/sh 1 #!/bin/bash -p
2 2
3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Using codesign, sign the application. Inner components are signed as needed, 7 # Using codesign, sign the application. After signing, the signatures on the
8 # then the outermost bundle is signed, and everything is verified. 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.
9 11
10 set -e 12 set -eu
11 13
12 if [ $# -ne 3 ] ; then 14 # Environment sanitization. Set a known-safe PATH. Clear environment variables
13 echo "usage: ${0} APP_PATH CODESIGN_KEYCHAIN CODESIGN_ID" >& 2 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
14 exit 1 29 exit 1
15 fi 30 fi
16 31
17 APP_PATH="${1}" 32 app_path="${1}"
18 CODESIGN_KEYCHAIN="${2}" 33 codesign_keychain="${2}"
19 CODESIGN_ID="${3}" 34 codesign_id="${3}"
20 35
21 # Use custom resource rules for the browser application. 36 # Use custom resource rules for the browser application.
22 BROWSER_APP_RULES="$(dirname "${0}")/app_resource_rules.plist" 37 script_dir="$(dirname "${0}")"
38 browser_app_rules="${script_dir}/app_resource_rules.plist"
23 39
24 # An .app bundle to be signed can be signed directly. Normally, signging a 40 versioned_dir="${app_path}/Contents/Versions/@VERSION@"
25 # framework bundle requires that each version within be signed individually.
26 # http://developer.apple.com/mac/library/technotes/tn2007/tn2206.html#TNTAG13
27 # In Chrome's case, the framework bundle is unversioned, so it too can be
28 # signed directly. See copy_framework_unversioned.
29 41
30 BROWSER_APP="${APP_PATH}" 42 browser_app="${app_path}"
31 FRAMEWORK="${BROWSER_APP}/Contents/Versions/@VERSION@/@MAC_PRODUCT_NAME@ Framewo rk.framework" 43 framework="${versioned_dir}/@MAC_PRODUCT_NAME@ Framework.framework"
32 HELPER_APP="${BROWSER_APP}/Contents/Versions/@VERSION@/@MAC_PRODUCT_NAME@ Helper .app" 44 helper_app="${versioned_dir}/@MAC_PRODUCT_NAME@ Helper.app"
33 45
34 echo "${0}: signing..." 46 codesign -s "${codesign_id}" --keychain "${codesign_keychain}" \
47 "${browser_app}" --resource-rules "${browser_app_rules}"
35 48
36 # Sign the outer .app last so that its seal includes the signed inner 49 # Verify everything. Check the framework and helper app to make sure that the
37 # components. 50 # signatures are present and weren't altered by the signing process.
38 51 codesign -v "${framework}"
39 codesign -s "${CODESIGN_ID}" --keychain "${CODESIGN_KEYCHAIN}" "${FRAMEWORK}" 52 codesign -v "${helper_app}"
40 codesign -s "${CODESIGN_ID}" --keychain "${CODESIGN_KEYCHAIN}" "${HELPER_APP}" 53 codesign -v "${browser_app}"
41 codesign -s "${CODESIGN_ID}" --keychain "${CODESIGN_KEYCHAIN}" \
42 "${BROWSER_APP}" --resource-rules "${BROWSER_APP_RULES}"
43
44 # Verify everything to ensure that signing the outer bundle didn't break an
45 # inner bundle.
46
47 echo "${0}: verifying..."
48
49 codesign -v "${FRAMEWORK}"
50 codesign -v "${HELPER_APP}"
51 codesign -v "${BROWSER_APP}"
OLDNEW
« no previous file with comments | « chrome/installer/mac/sign.sh.in ('k') | chrome/installer/mac/sign_versioned_dir.sh.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698