|
| 1 | +# Fusion CLI |
| 2 | +<AppliesTo all /> |
| 3 | +Integrate directly using the command line interface. |
| 4 | + |
| 5 | +If there isn't a native library, or command line bindings for your language yet, you can directly integrate Velopack using the command line. |
| 6 | + |
| 7 | +***There are two binaries needed.*** |
| 8 | + |
| 9 | +## Fusion |
| 10 | +`Vfusion.exe` / `VfusionMac` / `VFusionNix`<br/> |
| 11 | +Provides support for getting current version, checking for updates, downloading updates etc. |
| 12 | + |
| 13 | +:::warning |
| 14 | +At this time, the fusion binary is not automatically distributed, and you need to copy this into your compiler output directory. |
| 15 | +You can download a [recent build artifact](https://github.com/velopack/velopack.fusion/actions) and make sure it's copied to your output dir during builds. |
| 16 | +::: |
| 17 | + |
| 18 | +### Example |
| 19 | +``` |
| 20 | +> Vfusion.exe check --url https://the.place/you-host/updates |
| 21 | +``` |
| 22 | + |
| 23 | +These are the possible outputs: |
| 24 | +- **No updates are available:** empty stdout and `exitCode == 0`. |
| 25 | +- **Unrecoverable error:** empty stdout and `exitCode != 0`. A [log file](#logging) will be created. |
| 26 | +- **Update is availble:** stdout contains json object and `exitCode == 0`. |
| 27 | + |
| 28 | +When an update is available, you'll receive an [UpdateInfo](../reference/cs/Velopack/UpdateInfo.md) object via stdout: |
| 29 | + |
| 30 | +```json |
| 31 | +{ |
| 32 | + "isDowngrade": false, |
| 33 | + "targetFullRelease": { |
| 34 | + "packageId": "YourPackageId", |
| 35 | + "version": "2.0.1", |
| 36 | + "type": "Full", |
| 37 | + "fileName": "YourPackageId-2.0.1-full.nupkg", |
| 38 | + "sha1": "331a4f44a6a875b2ce139ae0c9ce5bb5e1ec0d97", |
| 39 | + "size": 90654, |
| 40 | + "notesMarkdown": "# Release v2.0.1 \n Your message here", |
| 41 | + "notesHtml": "<h1>Release v2.0.1</h2><br/>Your message here" |
| 42 | + } |
| 43 | +} |
| 44 | +``` |
| 45 | + |
| 46 | +The next step is to download an update to disk, using the `fileName` property from the previous command: |
| 47 | + |
| 48 | +``` |
| 49 | +> Vfusion.exe download \ |
| 50 | + --url https://the.place/you-host/updates \ |
| 51 | + --name YourPackageId-2.0.1-full.nupkg |
| 52 | +``` |
| 53 | + |
| 54 | +During this command, fusion will output the current download progress to stdout. For example: |
| 55 | +``` |
| 56 | +10 |
| 57 | +20 |
| 58 | +30 |
| 59 | +40 |
| 60 | +... |
| 61 | +``` |
| 62 | + |
| 63 | +You can parse each line of stdout (split by `\n`) and show progress to your users. |
| 64 | + |
| 65 | +If `exitCode == 0` the command was successful. |
| 66 | + |
| 67 | +To get the final path to the downloaded asset, you can combine the result of `Vfusion.exe get-packages` and `fileName`. |
| 68 | + |
| 69 | +To install the update, please see the next section. |
| 70 | + |
| 71 | +:::tip |
| 72 | +There are other commands (eg. `get-version`) which may be useful, explore them with `Vfusion.exe -h` |
| 73 | +::: |
| 74 | + |
| 75 | +## Updater |
| 76 | +`Update.exe` / `UpdateMac` / `UpdateNix`<br/> |
| 77 | +Provides support for installing downloaded updates, prompting for elevation (if required), bootstrapping [dependencies](../packaging/bootstrapping.mdx), and so forth. |
| 78 | + |
| 79 | +:::info |
| 80 | +This binary is automatically copied into your package when building `vpk`, you just need to locate it relative to your main executable. |
| 81 | +::: |
| 82 | + |
| 83 | +You will use the `update apply` command to install a downloaded update. |
| 84 | + |
| 85 | +### Example |
| 86 | + |
| 87 | +``` |
| 88 | +> Update.exe apply --restart |
| 89 | +``` |
| 90 | + |
| 91 | +Running the above command will immediately close your program, install the update, and restart your app on the new version. |
| 92 | + |
| 93 | +:::tip |
| 94 | +If called with no arguments, Update will apply the newest downloaded release, as long as it's newer than the currently installed release. |
| 95 | +If you would like to install an older release, you need to specify the `--package` parameter. |
| 96 | +::: |
| 97 | + |
| 98 | +All of the available apply options are below: |
| 99 | + |
| 100 | +``` |
| 101 | +update apply: |
| 102 | +Applies a staged / prepared update, installing prerequisite runtimes if necessary |
| 103 | + -r, --restart Restart the application after the update |
| 104 | + -w, --wait Wait for the parent process to terminate before applying the update |
| 105 | + --waitPid <PID> Wait for the specified process to terminate before applying the update |
| 106 | + -p, --package <FILE> Update package to apply |
| 107 | + -h, --help Print help |
| 108 | + [EXE_ARGS]... Arguments to pass to the restarted executable. Must be preceeded by '--'. |
| 109 | +``` |
| 110 | + |
| 111 | +## Logging |
| 112 | +Since errors are not printed on stdout, it is important to know where to locate log files to diagnose errors. |
| 113 | + |
| 114 | +### Windows |
| 115 | +Updater will log to it's own directory, and Fusion will log to the folder one above itself. |
| 116 | +In a typical installation, this will result in both the Fusion logs and Updater log being merged into one log file. |
| 117 | + |
| 118 | +### Linux and MacOS |
| 119 | +On UNIX-like operating systems, the logs for these binaries always go to `/tmp/velopack.log`. |
0 commit comments