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

Side by Side Diff: remoting/host/installer/mac/do_signing.sh

Issue 10197005: [Chromoting] Sign, brand and version the me2me_host (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | « remoting/host/installer/mac/build.sh ('k') | remoting/remoting.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
OLDNEW
(Empty)
1 #!/bin/sh
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 # This script signs the Chromoting binaries, builds the Chrome Remote Desktop
8 # installer and then packages it into a .dmg. It requires that Iceberg be
9 # installed (for 'freeze').
10 #
11 # usage: sign_and_build.sh output_dir input_dir codesign_keychain codesign_id
12 #
13 # The final disk image (dmg) is placed in |output_dir|.
14
15 set -e -u
16
17 # Binaries to sign.
18 ME2ME_HOST=PrivilegedHelperTools/org.chromium.chromoting.me2me_host
19
20 # Iceberg creates this directory to write its output.
21 PKG_DIR=build
22
23 # The Chromoting Host installer is a meta-package that consists of 3
24 # components:
25 # * Chromoting Host Service package
26 # * Chromoting Host Uninstaller package
27 # * Keystone package(GoogleSoftwareUpdate - for Official builds only)
28 PKGPROJ_HOST='ChromotingHost.packproj'
29 PKGPROJ_HOST_SERVICE='ChromotingHostService.packproj'
30 PKGPROJ_HOST_UNINSTALLER='ChromotingHostUninstaller.packproj'
31
32 # Final mpkg name (for Official builds).
33 PKG_FINAL='ChromeRemoteDesktopHost.mpkg'
34
35 DMG_TEMP=dmg_tmp
36 DMG_NAME='Chrome Remote Desktop'
37 DMG_DIR="${DMG_TEMP}/${DMG_NAME}"
38 DMG_FILENAME='Chrome Remote Desktop.dmg'
39
40 ME="$(basename "${0}")"
41 readonly ME
42
43 err() {
44 echo "[$(date +'%Y-%m-%d %H:%M:%S%z')]: ${@}" >&2
45 }
46
47 err_exit() {
48 err "${@}"
49 exit 1
50 }
51
52 # shell_safe_path ensures that |path| is safe to pass to tools as a
53 # command-line argument. If the first character in |path| is "-", "./" is
54 # prepended to it. The possibly-modified |path| is output.
55 shell_safe_path() {
56 local path="${1}"
57 if [[ "${path:0:1}" = "-" ]]; then
58 echo "./${path}"
59 else
60 echo "${path}"
61 fi
62 }
63
64 verify_empty_dir() {
65 local dir="${1}"
66 if [[ ! -d "${dir}" ]]; then
67 mkdir "${dir}"
68 fi
69
70 shopt -s nullglob dotglob
71 local dir_contents=("${dir}"/*)
72 shopt -u nullglob dotglob
73
74 if [[ ${#dir_contents[@]} -ne 0 ]]; then
75 err "output directory must be empty"
76 exit 1
77 fi
78 }
79
80 sign_binaries() {
81 local input_dir="${1}"
82 local keychain="${2}"
83 local id="${3}"
84
85 me2me_host="${input_dir}/${ME2ME_HOST}"
86 if [[ ! -f "${me2me_host}" ]]; then
87 err_exit "Input file doesn't exist: ${me2me_host}"
88 fi
89
90 echo Signing "${me2me_host}"
91 codesign -vv -s "${id}" --keychain "${keychain}" "${me2me_host}"
92
93 # Verify signing.
94 codesign -v "${me2me_host}"
95 }
96
97 build_package() {
98 local pkg="${1}"
99 echo "Building .pkg from ${pkg}"
100 freeze "${pkg}"
101 }
102
103 build_packages() {
104 local input_dir="${1}"
105 build_package "${input_dir}/${PKGPROJ_HOST_SERVICE}"
106 build_package "${input_dir}/${PKGPROJ_HOST_UNINSTALLER}"
107 build_package "${input_dir}/${PKGPROJ_HOST}"
108 }
109
110 build_dmg() {
111 local input_dir="${1}"
112 local output_dir="${2}"
113
114 # TODO(garykac): Change this to use the pkg-dmg script.
115
116 # Create the .dmg.
117 echo "Building .dmg..."
118 mkdir -p "${input_dir}/${DMG_DIR}/${PKG_FINAL}"
119 # Copy .mpkg installer.
120 ditto "${input_dir}/${PKG_DIR}/${PKG_FINAL}" \
121 "${input_dir}/${DMG_DIR}/${PKG_FINAL}"
122 # Copy .keystone_install script to top level of .dmg.
123 # Keystone calls this script during upgrades.
124 cp "${input_dir}/Scripts/keystone_install.sh" \
125 "${input_dir}/${DMG_DIR}/.keystone_install"
126 # Build the .dmg from the directory.
127 hdiutil create "${output_dir}/${DMG_FILENAME}" \
128 -srcfolder "${input_dir}/${DMG_DIR}" -ov -quiet
129
130 if [[ ! -f "${output_dir}/${DMG_FILENAME}" ]]; then
131 err_exit "Unable to create disk image: ${DMG_FILENAME}"
132 fi
133 }
134
135 usage() {
136 echo "Usage: ${ME}: output_dir input_dir codesign_keychain codesign_id" >&2
137 }
138
139 main() {
140 local output_dir="$(shell_safe_path "${1}")"
141 local input_dir="$(shell_safe_path "${2}")"
142 local codesign_keychain="$(shell_safe_path "${3}")"
143 local codesign_id="${4}"
144
145 verify_empty_dir "${output_dir}"
146
147 sign_binaries "${input_dir}" "${codesign_keychain}" "${codesign_id}"
148 build_packages "${input_dir}"
149 # TODO(garykac): Sign final .mpkg.
150 build_dmg "${input_dir}" "${output_dir}"
151 }
152
153 if [[ ${#} -ne 4 ]]; then
154 usage
155 exit 1
156 fi
157
158 main "${@}"
159 exit ${?}
OLDNEW
« no previous file with comments | « remoting/host/installer/mac/build.sh ('k') | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698