blob: db6e1c2b1860ab1a551cde5b87bea09c4f91817b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/bin/sh
# 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.
set -e
if [ $# -ne 3 ] ; then
echo "usage: ${0} PACKAGING_DIR MAC_PRODUCT_NAME VERSION" >& 2
exit 1
fi
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"
# 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')"
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}"
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}"
|