OLD | NEW |
| (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 builds the Chrome Remote Desktop installer and packages | |
8 # it into a .dmg. It requires that Iceberg be installed (for 'freeze'). | |
9 | |
10 # The Chrome Remote Desktop installer consists of 2 components: | |
11 # * Chromoting installer package | |
12 # * Keystone (Google auto-update) | |
13 | |
14 error_exit() { | |
15 echo "ERROR - $@" 1>&2; | |
16 exit 1; | |
17 } | |
18 | |
19 PKG_DIR=build | |
20 PKGPROJ_CHROMOTING='Chromoting.packproj' | |
21 PKGPROJ_CRD='ChromeRemoteDesktop.packproj' | |
22 PKGPROJ_CRD_UNINSTALLER='ChromeRemoteDesktopUninstaller.packproj' | |
23 PKG_CHROMOTING='Chromoting.pkg' | |
24 PKG_CRD='Chrome Remote Desktop.mpkg' | |
25 | |
26 DMG_TEMP=dmg_tmp | |
27 DMG_NAME='Chrome Remote Desktop' | |
28 DMG_DIR="$DMG_TEMP/$DMG_NAME" | |
29 DMG_FILENAME='Chrome Remote Desktop.dmg' | |
30 | |
31 # Clean out previous build. | |
32 rm -rf "$PKG_DIR" | |
33 rm -f "$DMG_FILENAME" | |
34 rm -rf "$DMG_TEMP" # In case previous build failed. | |
35 | |
36 # Copy latest release build. | |
37 # TODO(garykac): Get from proper location. | |
38 TARGET_DIR="../../../../xcodebuild/Release" | |
39 HOST_SRC="$TARGET_DIR/remoting_me2me_host" | |
40 HOST_DST="./PrivilegedHelperTools/org.chromium.chromoting.me2me_host" | |
41 if [[ ! -f "$HOST_SRC" ]]; then | |
42 error_exit "Unable to find $HOST_SRC"; | |
43 fi | |
44 cp "$HOST_SRC" "$HOST_DST" | |
45 | |
46 UNINSTALLER_SRC="$TARGET_DIR/remoting_host_uninstaller.app" | |
47 UNINSTALLER_DST="./Applications/Chrome Remote Desktop Host Uninstaller.app" | |
48 if [[ ! -d "$UNINSTALLER_SRC" ]]; then | |
49 error_exit "Unable to find $UNINSTALLER_SRC"; | |
50 fi | |
51 ditto "$UNINSTALLER_SRC" "$UNINSTALLER_DST" | |
52 | |
53 # Verify that the host is the official build | |
54 OFFICIAL_CLIENTID=440925447803-avn2sj1kc099s0r7v62je5s339mu0am1 | |
55 UNOFFICIAL_CLIENTID=440925447803-2pi3v45bff6tp1rde2f7q6lgbor3o5uj | |
56 grep -qF "$OFFICIAL_CLIENTID" "$HOST_DST" | |
57 if [[ "$?" != "0" ]]; then | |
58 grep -qF "$UNOFFICIAL_CLIENTID" "$HOST_DST" | |
59 if [[ "$?" == "0" ]]; then | |
60 error_exit "Attempting to build with unoffical build"; | |
61 else | |
62 error_exit "Unable to determine build type"; | |
63 fi | |
64 fi | |
65 | |
66 # Unzip Keystone. | |
67 cd Keystone | |
68 unzip -qq -o GoogleSoftwareUpdate.pkg.zip | |
69 cd .. | |
70 | |
71 # Build the .pkg. | |
72 echo "Building .pkg..." | |
73 freeze "$PKGPROJ_CHROMOTING" | |
74 freeze "$PKGPROJ_CRD_UNINSTALLER" | |
75 freeze "$PKGPROJ_CRD" | |
76 | |
77 # Create the .dmg. | |
78 echo "Building .dmg..." | |
79 mkdir -p "$DMG_DIR/$PKG_CRD" | |
80 # Copy .mpkg installer. | |
81 ditto "$PKG_DIR/$PKG_CRD" "$DMG_DIR/$PKG_CRD" | |
82 # Copy .keystone_install script to top level of .dmg. | |
83 # Keystone calls this script during upgrades. | |
84 cp Scripts/keystone_install.sh "$DMG_DIR/.keystone_install" | |
85 # Build the .dmg from the directory. | |
86 hdiutil create "$DMG_FILENAME" -srcfolder "$DMG_DIR" -ov -quiet | |
87 rm -rf "$DMG_TEMP" | |
OLD | NEW |