Skip to content

Instantly share code, notes, and snippets.

@enlight
Last active March 10, 2016 16:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enlight/7fe93e9331e9021821f7 to your computer and use it in GitHub Desktop.
Save enlight/7fe93e9331e9021821f7 to your computer and use it in GitHub Desktop.
Using Electron auto-updater with Squirrel.Windows
From #electron Slack
weiway:
Hi guys, I'm really confused by autoUpdater API on windows. On one hand, I believe windows autoUpdater
has an uniform API with OSX, but on the other hand, I know squirrel handles OSX and Windows quite differently.
So my question is do I need to handle to squirrel events? Or I ONLY need to use the autoUpdater events to
handle update logic?
On windows
And also I'm confused when squirrel handles install and when squirrel handles update. If write install logic
into main.js, does that mean every time my app starts squirrel will try to re-install?
paulcbetts:
@weiway: Yes
You need to handle them
Squirrel.Windows calls ​_your app_​ when certain installation-related things are happening
Giving you a chance to do something, like install shortcuts or set up reg keys or whatever
weiway:
@paulcbetts: ok, Is that mean I handle the squirrel events at first, then handle the
autoupdater events after app is ready?
paulcbetts:
Correct
Squirrel events are just Setup.exe running your app
There's no magic to it
But the trick is, Setup.exe will only wait a certain amount of time before assuming it has failed
So you should handle it super early
weiway:
oh so Squirrel Events are just Setup.exe telling me what's going on with my app?
paulcbetts:
Squirrel Events are literally Setup.exe just spawning your app with `--squirrel-installed 1.2.3`
as a command-line parameter
You can test them by just running your app with those parameters
If your app does a thing, then immediately exits, you're good
weiway:
ok, so the actual updating is handled by autoUpdater (via Squirrel)
paulcbetts:
Yeah
autoUpdater's implementation on Windows just spawns Update.exe and reports its output basically
weiway:
@paulcbetts: thanks alot! I think I now know what to do, BTW, by any chance you know where I can find
a guide/requirement for Squirrel.Windows Server guide, their docs are pretty sparse
paulcbetts:
Squirrel.Windows doesn't need any server
Just take the folder that Squirrel.exe --releasify makes and upload it to S3
(or anywhere else)
For debugging, you can also use just a path to a folder on your machine as the update "server"
Which makes testing updates way easier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment