OLD | NEW |
1 # Chrome Installer for Mac -- the repository! | 1 # Chrome Installer for Mac -- the repository! |
2 | 2 |
| 3 This Mac app installs Chrome on the machine it's run on. It's meant to be the |
| 4 Mac app the user first downloads when they click 'Download Chrome' on a Mac |
| 5 machine. After the user runs the app, Chrome would launch directly after |
| 6 installation completes successfully. |
| 7 |
3 ## The 10,000 Foot View | 8 ## The 10,000 Foot View |
4 | 9 |
5 This Mac app installs Chrome on the machine it's run on. To do so, it breaks | 10 The installer breaks down its task into the following steps: |
6 down installation into the following basic steps: | |
7 | 11 |
8 1. __OmahaCommunication__: Ask Omaha for a URL of the most recent compatible | 12 1. __OmahaCommunication__: Ask Omaha for a URL of the most recent compatible |
9 copy of the Google Chrome disk image in Google's servers. | 13 copy of the Google Chrome disk image in Google's servers. |
10 2. __Downloader__: Download the disk image, via URL from OmahaCommunication. | 14 2. __Downloader__: Download the disk image, via URL from OmahaCommunication. |
11 3. __Unpacker__: Mount the disk image and extract the Chrome app bundle. | 15 3. __Unpacker__: Mount the disk image and extract the Chrome app bundle. |
12 4. __AuthorizedInstall__: With privilege escalation if able, move the Chrome | 16 4. __AuthorizedInstall__: With privilege escalation if able, move the Chrome |
13 app into the Applications folder, set permissions, and hand ownership of | 17 app into the Applications folder, set permissions, and hand ownership of |
14 the Chrome app to `root`. | 18 the Chrome app to `root`. |
15 5. Launch Chrome & close. | 19 5. Launch Chrome & close. |
16 | 20 |
(...skipping 14 matching lines...) Expand all Loading... |
31 will take care of any tear-down tasks before exiting naturally. | 35 will take care of any tear-down tasks before exiting naturally. |
32 | 36 |
33 We initialize the AuthorizedInstall class early in the life of the installer so | 37 We initialize the AuthorizedInstall class early in the life of the installer so |
34 the user can immediately choose to authorize the installer for root installation
. | 38 the user can immediately choose to authorize the installer for root installation
. |
35 The script consumes the authorization token (which expires in five minutes by | 39 The script consumes the authorization token (which expires in five minutes by |
36 default) immediately, then waits until the installer has progressed to step 4 | 40 default) immediately, then waits until the installer has progressed to step 4 |
37 (above). | 41 (above). |
38 | 42 |
39 ## The Class Breakdown | 43 ## The Class Breakdown |
40 | 44 |
41 AppDelegate | Controls the flow of the program | 45 | Class | Role
| |
42 AuthorizedInstall | Attempts authorization to add Chrome to | 46 |----------------------------|--------------------------------------------------
--| |
43 | Applications folder and adjust permissions as root | 47 | AppDelegate | Controls the flow of the program
| |
44 Downloader | Downloads GoogleChrome.dmg from Omaha Servers | 48 | AuthorizedInstall | Attempts authorization to add Chrome to the Appli
cations folder and adjust permissions as root | |
45 InstallerWindowController | Controls the user interface | 49 | Downloader | Downloads GoogleChrome.dmg from Omaha servers
| |
46 OmahaCommunication | Talks with Omaha Servers to get URL of disk image | 50 | InstallerWindowController | Controls the user interface
| |
47 OmahaXMLParser | Extracts URLs from Omaha's XML response. | 51 | OmahaCommunication | Talks with Omaha Servers to get URL of disk image
| |
48 OmahaXMLRequest | Creates an XML request to send to Omaha. | 52 | OmahaXMLParser | Extracts URLs from Omaha's XML response
| |
49 SystemInfo | Provides system information to help craft the XML | 53 | OmahaXMLRequest | Creates an XML request to send to Omaha
| |
50 | request for Omaha. | 54 | SystemInfo | Provides system information to help craft the XML
request for Omaha | |
51 Unpacker | Mounts the disk image and controls the temporary | 55 | Unpacker | Mounts the disk image and controls the temporary
directory that abstracts the installer's file-manipulating activity from the use
r | |
52 | directory that abstracts the installer's | |
53 | file-manipulating activity from the user. | |
54 | 56 |
55 ## The Future | 57 ## The Future |
56 | 58 |
57 Here lies a list of hopes and dreams: | 59 Here lies a list of hopes and dreams: |
58 | 60 |
59 * Implement resumable downloads. | 61 * Implement resumable downloads. |
60 * Add in adequate testing using a local test server. | 62 * Add in adequate testing using a local test server. |
61 * Include basic error recovery attempts -- say, if during a download a URL | 63 * Include basic error recovery attempts -- say, if during a download a URL |
62 does not provide a valid disk image, the installer can try re-downloading | 64 does not provide a valid disk image, the installer can try re-downloading |
63 the disk image from another URL. | 65 the disk image from another URL. |
64 * Manage potential conflicts, in the case that Google Chrome already exists in | 66 * Manage potential conflicts, in the case that Google Chrome already exists in |
65 the Applications folder when the installer is run. | 67 the Applications folder when the installer is run. |
66 * Trash the installer application after it has completed running. | 68 * Trash the installer application after it has completed running. |
| 69 |
| 70 ## Diagram Appendix |
| 71 |
| 72 ### Task Flow |
| 73 |
| 74 ``` |
| 75 |
| 76 Exposed Errors Main Logic |
| 77 |
| 78 +--------------------------------------+ |
| 79 | | |
| 80 | Request authentication from users | |
| 81 | | |
| 82 +------------------+-------------------+ |
| 83 | |
| 84 +------------------v-------------------+ |
| 85 | | |
| 86 +--------+ Ask Omaha for appropriate Chrome app | |
| 87 v | | |
| 88 +------------------+-------------------+ |
| 89 Network Error | |
| 90 +------------------v-------------------+ |
| 91 ^ | | |
| 92 +--------+ Parse the response from Omaha | |
| 93 | | |
| 94 +------------------+-------------------+ |
| 95 | |
| 96 +------------------v-------------------+ |
| 97 | | |
| 98 Download Error <-+ Download the Chrome disk image | |
| 99 | | |
| 100 +------------------+-------------------+ |
| 101 | |
| 102 +------------------v-------------------+ |
| 103 | | |
| 104 +--------+ Mount the disk image | |
| 105 v | | |
| 106 +------------------+-------------------+ |
| 107 Install Error | |
| 108 +------------------v-------------------+ |
| 109 ^ | | |
| 110 +--------+ Install & Configure Chrome app | |
| 111 | | |
| 112 +------------------+-------------------+ |
| 113 | |
| 114 +------------------v-------------------+ |
| 115 | | |
| 116 | Unmount disk image +-> If unmount fails, sy
stem |
| 117 | | restart can resolve
this. |
| 118 +------------------+-------------------+ |
| 119 | |
| 120 +------------------v-------------------+ |
| 121 | | |
| 122 Launch Error <-+ Launch Chrome | |
| 123 | | |
| 124 +--------------------------------------+ |
| 125 |
| 126 ``` |
| 127 |
| 128 ### Class Heirarchy |
| 129 |
| 130 ``` |
| 131 |
| 132 Users |
| 133 |
| 134 ^ + |
| 135 | | |
| 136 | | |
| 137 +-------------------------------+-----v--------------------------------+ |
| 138 | | |
| 139 | InstallerWindowController | |
| 140 | | |
| 141 +-------+------^------------+---^--------+----^---------+---------^----+ |
| 142 | | | | | | | | |
| 143 | | | | | | | | |
| 144 | | | | | | | | |
| 145 +-------v------+------------v---+--------v----+---------v---------+----+ |
| 146 | | |
| 147 | AppDelegate | |
| 148 | | |
| 149 +-------+------^------------+---^--------+----^---------+---------^----+ |
| 150 | | | | | | | | |
| 151 | | | | | | | | |
| 152 | | | | | | | | |
| 153 +-------v------+-----+ +----v---+---+ +--v----+--+ +----v---------+----+ |
| 154 | | | | | | | | |
| 155 | OmahaCommunication | | Downloader | | Unpacker | | AuthorizedInstall | |
| 156 | | | | | | | | |
| 157 +-------^------^-----+ +------------+ +----------+ +---------^---------+ |
| 158 | | | |
| 159 | +------------+ | |
| 160 | | | |
| 161 +-------+---------+ +-------+--------+ +--------+--------+ |
| 162 | | | | | | |
| 163 | OmahaXMLRequest | | OmahaXMLParser | | copy_to_disk.sh | |
| 164 | | | | | | |
| 165 +-------^---------+ +----------------+ +-----------------+ |
| 166 | |
| 167 | |
| 168 | |
| 169 +-----+------+ |
| 170 | | |
| 171 | SystemInfo | |
| 172 | | |
| 173 +------------+ |
| 174 |
| 175 ``` |
OLD | NEW |