Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to build Windows installer without autoupdate? #279

Closed
bsharper opened this issue Mar 30, 2016 · 14 comments
Closed

Possible to build Windows installer without autoupdate? #279

bsharper opened this issue Mar 30, 2016 · 14 comments

Comments

@bsharper
Copy link

electron-builder is immensely useful, however a recent update has introduced a few issues I wanted to ask about.

I'm using Electron to rebuild a custom network diagnostic utility for work. This utility is not used regularly by any single client. In most circumstances it will be used for several hours then removed. Additionally, it is likely that one of our support staff will be installing and running it over an RDP session while the client watches.

Due to the nature of the utility I'm making, having the autoupdate feature isn't necessary. The previous version of electron-builder I used allowed the generation of NSIS executables, which was perfect, but that feature has since been removed. The new default installer shows an animated image that appears to be from Atom, closes the main program and reopens it before finally allowing continued operation. I could not see a way to disable the animation or prevent the main program from exiting once before running. I'm not setting an update URL that it would be checking, so I'm not even sure where/how it's checking for an update.

I have little doubt that a future Electron project I work on will benefit from having autoupdate built in, but for this one it seems to be getting in the way.

Questions:

  1. Is it possible to build a Windows installer exe that simply starts the program without any animation or update checks?
  2. If it is not possible to hide the animation, is it possible to customize it?
  3. If none of the above are possible with the Squirrel installer, would it be possible to re-enable the NSIS target option?

Thank you!

@develar
Copy link
Member

develar commented Mar 30, 2016

If it is not possible to hide the animation, is it possible to customize it

Please see electron/windows-installer#42

Other questions — accepted, will be investigated.

@havenchyk
Copy link
Contributor

@bsharper basically, you can use target nsis, it's still possible (but removed from readme, I'm not sure why). @develar isn't it?

@develar
Copy link
Member

develar commented Mar 30, 2016

@havenchyk No, it not possible anymore.

@havenchyk
Copy link
Contributor

Ah, I see the commit. It's not possible.

@develar basically, we can just skip including of Update.exe into the build, isn't it?

@demetris-manikas
Copy link
Contributor

@bsharper I have seen the behaviour before. The double run will go away as soon as you implement the handing of squirrel events. You don't need to do anything special just quit the app where you should.
Just like this https://github.com/electron/windows-installer#handling-squirrel-events.
It is not much of a hassle and you 'll be on your way

@bsharper
Copy link
Author

@demetris-manikas Thank you for the information. If I understand this correctly, I need to check for the squirrel arguments early on (before new BrowserWindow('file.html') is called) and quit if they exist. I'll give this a try.

@bsharper
Copy link
Author

@develar That information was what I was looking for, thanks!

@bsharper
Copy link
Author

@demetris-manikas That worked perfectly. I think squirrel was waiting 15 seconds then killing my program since it was expecting it to quit. Stopping it early on in the code made it start much faster. One of my test machines is an old laptop, and it was taking 30 seconds to get to where I could actually do anything. Now it's starting much more quickly. Thanks again.

@bsharper
Copy link
Author

@develar Replacing the GIF with a transparent GIF did the trick, and @demetris-manikas link fixed my other issue. If it were possible to disable the loading animation and forced quit via the electron-builder options, the new installer would be at parity with NSIS for apps that don't need to auto-update, at least in my opinion.

@develar
Copy link
Member

develar commented Apr 5, 2016

@bsharper I think, both solutions — NSIS (requires explicit installation) and Squirrel (autoupdate and other mentioned here issues) are not suitable for you.

I think, SFX (self-extraction archive) is the best solution for you. Demo — https://www.dropbox.com/s/05w7w1trxiygiij/TestApp-win32-x64.exe?dl=1 (it is a 7z SFX).

@bsharper
Copy link
Author

bsharper commented Apr 5, 2016

@develar Thanks for the suggestion. I'm hesitant to use a self-extracting archive because Electron will leave files behind under either C:\Users\User\AppData\ProgramName or ~/Application Support/Library/ProgramName. I know this will unlikely cause any issues for the user, but I like having a clean uninstall when possible. Also hiding the support files (like content_resources_200_percent.pak) looks cleaner.

I was able to get Squirrel working more or less the way I wanted. I can close this issue if there no objections. After adding the check for the Squirrel command line switches (quitting early when appropriate) and creating a new "installing GIF", I'm happy with how it works now. I wasn't getting a desktop shortcut, so I created a simple NPM package to create a Desktop shortcut on Windows which runs after the initial install. I do really like the fact that Squirrel installs to the user's path instead of Program Files which requires admin. My program doesn't require admin rights to run, so this makes for a better experience.

Just a thought, it might be useful to have a flag (handleSquirrelArguments maybe?) to let devs indicate if they are checking for the Squirrel args or not. If handleSquirrelArguments is true, builder could point to a different entry point that does quick check to see if one of the updater arguments is present, and quit if so. Otherwise it would run the normal main.js script.

@develar
Copy link
Member

develar commented Apr 5, 2016

I wasn't getting a desktop shortcut, so I created

Hmm... Why solution https://github.com/develar/onshape-desktop-shell/blob/master/src/WinSquirrelStartupEventHandler.ts#L24 doesn't work for you?

@develar
Copy link
Member

develar commented Apr 5, 2016

to have a flag (handleSquirrelArguments maybe?) to let devs indicate if

We should fix incomplete windows-installer docs and add link to https://github.com/mongodb-js/electron-squirrel-startup

I don't want to add such option, because it is out of scope. https://github.com/mongodb-js/electron-squirrel-startup#usage is very simple to do.

@bsharper
Copy link
Author

bsharper commented Apr 6, 2016

Hmm... Why solution https://github.com/develar/onshape-desktop-shell/blob/master/src/WinSquirrelStartupEventHandler.ts#L24 doesn't work for you?

Wow, I don't know how I missed that. I cloned that repo and looked through the autoupdate file, even grepped "icon" just not "shortcut".

We should fix incomplete windows-installer docs and add link to https://github.com/mongodb-js/electron-squirrel-startup

I don't want to add such option, because it is out of scope. https://github.com/mongodb-js/electron-squirrel-startup#usage is very simple to do.

Understood. Thanks again for taking the time to look at the issues I was having.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants