1# Mac Installer API
2This document briefly goes over the installer API for the updater on macOS.
3
4## Design
5The Installer API is the integration between the app installer and the updater,
6and is platform specific. The main functionality for doing the updates in the
7new updater will be an update executable (.install). The update executable will
8be invoked by the updater when there is an update available.
9
10The Installer API will be called through `Installer::RunApplicationInstaller()`,
11which takes `const base::FilePath&` for the path to the installer and
12`const std::string& arguments` for any arguments. This will then call
13`InstallFromDMG()`, which takes the same parameters. `InstallFromDMG()` then
14executes `.install` with the correct arguments.
15
16## .install
17
18### Usage
19The installer DMG will have the .install executable in the root of the volume
20and the new application embedded within.
21
22Currently the install executable takes just three arguments - an absolute path
23to the DMG, an absolute path to the currently installed app, and the version of
24the currently installed app. `Installer::RunApplicationInstaller()`, will append
25the existence checker path (path to the installed app) and the version from the
26registration into the args.
27
28For example, `Google Chrome.dmg`, will contain `Google Chrome.app` and
29`.install` executable. Here is an example of what `InstallFromDMG()` will run:
30
31i.e.
32```
33./.install "/Volumes/Google Chrome.dmg" "/Applications/Google Chrome.app" \
34"81.0.416.0"
35```
36
37### Exit Codes
38The current constraint for exit codes for the `.install` executable is that 0 is
39a successful update, and every other value is an error of some kind. For
40documentation on the existing exit codes for the implemented .install
41executable, please refer to `//chrome/updater/mac/setup/.install.sh`.
42
43### Non-executable Error Codes
44When executing `InstallFromDMG()`, there can also be cases in which the
45Installer API fails before the install executable is executed. These are
46translated from the enum `updater::InstallErrors`. Please refer to
47`//chrome/updater/mac/install.h` for documentation on these error codes.
48