| Index: chrome/installer/mac/sign_versioned_dir.sh.in
|
| ===================================================================
|
| --- chrome/installer/mac/sign_versioned_dir.sh.in (revision 49433)
|
| +++ chrome/installer/mac/sign_versioned_dir.sh.in (working copy)
|
| @@ -1,51 +1,51 @@
|
| -#!/bin/sh
|
| +#!/bin/bash -p
|
|
|
| # Copyright (c) 2009 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.
|
|
|
| -# Using codesign, sign the application. Inner components are signed as needed,
|
| -# then the outermost bundle is signed, and everything is verified.
|
| +# Using codesign, sign the contents of the versioned directory. Namely, this
|
| +# includes the framework and helper app. After signing, the signatures are
|
| +# verified.
|
|
|
| -set -e
|
| +set -eu
|
|
|
| -if [ $# -ne 3 ] ; then
|
| - echo "usage: ${0} APP_PATH CODESIGN_KEYCHAIN CODESIGN_ID" >& 2
|
| +# Environment sanitization. Set a known-safe PATH. Clear environment variables
|
| +# that might impact the interpreter's operation. The |bash -p| invocation
|
| +# on the #! line takes the bite out of BASH_ENV, ENV, and SHELLOPTS (among
|
| +# other features), but clearing them here ensures that they won't impact any
|
| +# shell scripts used as utility programs. SHELLOPTS is read-only and can't be
|
| +# unset, only unexported.
|
| +export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
|
| +unset BASH_ENV CDPATH ENV GLOBIGNORE IFS POSIXLY_CORRECT
|
| +export -n SHELLOPTS
|
| +
|
| +ME="$(basename "${0}")"
|
| +readonly ME
|
| +
|
| +if [[ ${#} -ne 3 ]]; then
|
| + echo "usage: ${ME} app_path codesign_keychain codesign_id" >& 2
|
| exit 1
|
| fi
|
|
|
| -APP_PATH="${1}"
|
| -CODESIGN_KEYCHAIN="${2}"
|
| -CODESIGN_ID="${3}"
|
| +app_path="${1}"
|
| +codesign_keychain="${2}"
|
| +codesign_id="${3}"
|
|
|
| -# Use custom resource rules for the browser application.
|
| -BROWSER_APP_RULES="$(dirname "${0}")/app_resource_rules.plist"
|
| +versioned_dir="${app_path}/Contents/Versions/@VERSION@"
|
|
|
| -# An .app bundle to be signed can be signed directly. Normally, signging a
|
| +# An .app bundle to be signed can be signed directly. Normally, signging a
|
| # framework bundle requires that each version within be signed individually.
|
| # http://developer.apple.com/mac/library/technotes/tn2007/tn2206.html#TNTAG13
|
| # In Chrome's case, the framework bundle is unversioned, so it too can be
|
| -# signed directly. See copy_framework_unversioned.
|
| +# signed directly. See copy_framework_unversioned.
|
|
|
| -BROWSER_APP="${APP_PATH}"
|
| -FRAMEWORK="${BROWSER_APP}/Contents/Versions/@VERSION@/@MAC_PRODUCT_NAME@ Framework.framework"
|
| -HELPER_APP="${BROWSER_APP}/Contents/Versions/@VERSION@/@MAC_PRODUCT_NAME@ Helper.app"
|
| +framework="${versioned_dir}/@MAC_PRODUCT_NAME@ Framework.framework"
|
| +helper_app="${versioned_dir}/@MAC_PRODUCT_NAME@ Helper.app"
|
|
|
| -echo "${0}: signing..."
|
| +codesign -s "${codesign_id}" --keychain "${codesign_keychain}" "${framework}"
|
| +codesign -s "${codesign_id}" --keychain "${codesign_keychain}" "${helper_app}"
|
|
|
| -# Sign the outer .app last so that its seal includes the signed inner
|
| -# components.
|
| -
|
| -codesign -s "${CODESIGN_ID}" --keychain "${CODESIGN_KEYCHAIN}" "${FRAMEWORK}"
|
| -codesign -s "${CODESIGN_ID}" --keychain "${CODESIGN_KEYCHAIN}" "${HELPER_APP}"
|
| -codesign -s "${CODESIGN_ID}" --keychain "${CODESIGN_KEYCHAIN}" \
|
| - "${BROWSER_APP}" --resource-rules "${BROWSER_APP_RULES}"
|
| -
|
| -# Verify everything to ensure that signing the outer bundle didn't break an
|
| -# inner bundle.
|
| -
|
| -echo "${0}: verifying..."
|
| -
|
| -codesign -v "${FRAMEWORK}"
|
| -codesign -v "${HELPER_APP}"
|
| -codesign -v "${BROWSER_APP}"
|
| +# Verify everything.
|
| +codesign -v "${framework}"
|
| +codesign -v "${helper_app}"
|
|
|