| Index: chrome/installer/mac/make_signers.sh
|
| ===================================================================
|
| --- chrome/installer/mac/make_signers.sh (revision 49433)
|
| +++ chrome/installer/mac/make_signers.sh (working copy)
|
| @@ -1,48 +1,64 @@
|
| -#!/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.
|
|
|
| -# This script creates sign.sh, the script that will be used to sign the
|
| -# application bundle and inner bundles. It also creates auxiliary files that
|
| -# sign.sh needs to do its job, such as the custom resource rules used to sign
|
| -# the outermost application bundle. These files are placed in the Packaging
|
| -# directory next to the .app bundle. The packaging system is expected to run
|
| -# sign.sh to sign everything.
|
| +# This script creates sign_app.sh and sign_versioned_dir.sh, the scripts that
|
| +# will be used to sign the application bundle and inner bundles. It also
|
| +# creates auxiliary files that these scripts need to do their jobs, such as
|
| +# the custom resource rules used to sign the outermost application bundle.
|
| +# The build places these in the "${mac_product_name} Packaging" directory next
|
| +# to the .app bundle. The packaging system is expected to run these scripts to
|
| +# sign everything.
|
|
|
| -set -e
|
| +set -eu
|
|
|
| -if [ $# -ne 3 ] ; then
|
| - echo "usage: ${0} PACKAGING_DIR MAC_PRODUCT_NAME VERSION" >& 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} packaging_dir mac_product_name version" >& 2
|
| exit 1
|
| fi
|
|
|
| -PACKAGING_DIR="${1}"
|
| -MAC_PRODUCT_NAME="${2}"
|
| -VERSION="${3}"
|
| +packaging_dir="${1}"
|
| +mac_product_name="${2}"
|
| +version="${3}"
|
|
|
| -INPUT_DIR="$(dirname "${0}")"
|
| -SIGN_SH_IN_FILE="${INPUT_DIR}/sign.sh.in"
|
| -SIGN_SH_FILE="${PACKAGING_DIR}/sign.sh"
|
| -BROWSER_APP_RULES_IN_FILE="${INPUT_DIR}/app_resource_rules.plist.in"
|
| -BROWSER_APP_RULES_FILE="${PACKAGING_DIR}/app_resource_rules.plist"
|
| +script_dir="$(dirname "${0}")"
|
| +in_files=(
|
| + "${script_dir}/sign_app.sh.in"
|
| + "${script_dir}/sign_versioned_dir.sh.in"
|
| + "${script_dir}/app_resource_rules.plist.in"
|
| +)
|
|
|
| # Double-backslash each dot: one backslash belongs in the regular expression,
|
| # and the other backslash tells sed not to treat the first backslash
|
| # specially.
|
| -VERSION_REGEX="$(echo "${VERSION}" | sed -e 's/\./\\\\./g')"
|
| +version_regex="$(echo "${version}" | sed -e 's/\./\\\\./g')"
|
|
|
| -mkdir -p "${PACKAGING_DIR}"
|
| -sed -e "s/@MAC_PRODUCT_NAME@/${MAC_PRODUCT_NAME}/g" \
|
| - -e "s/@VERSION@/${VERSION}/g" \
|
| - -e "s/@VERSION_REGEX@/${VERSION_REGEX}/g" \
|
| - < "${SIGN_SH_IN_FILE}" \
|
| - > "${SIGN_SH_FILE}"
|
| -chmod +x "${SIGN_SH_FILE}"
|
| +mkdir -p "${packaging_dir}"
|
|
|
| -sed -e "s/@MAC_PRODUCT_NAME@/${MAC_PRODUCT_NAME}/g" \
|
| - -e "s/@VERSION@/${VERSION}/g" \
|
| - -e "s/@VERSION_REGEX@/${VERSION_REGEX}/g" \
|
| - < "${BROWSER_APP_RULES_IN_FILE}" \
|
| - > "${BROWSER_APP_RULES_FILE}"
|
| +for in_file in "${in_files[@]}"; do
|
| + out_file="${packaging_dir}/$(basename "${in_file:0:${#in_file} - 3}")"
|
| + sed -e "s/@MAC_PRODUCT_NAME@/${mac_product_name}/g" \
|
| + -e "s/@VERSION@/${version}/g" \
|
| + -e "s/@VERSION_REGEX@/${version_regex}/g" \
|
| + < "${in_file}" \
|
| + > "${out_file}"
|
| +
|
| + if [[ "${out_file: -3}" = ".sh" ]]; then
|
| + chmod +x "${out_file}"
|
| + fi
|
| +done
|
|
|