Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement auto-update electron app on Linux?

I use electron to create cross-platform application. For Windows and Mac it could be done by electron tools, like autoUpdate, Squirrel, so on.

The problem is only with Linux. I have built a .deb package for Ubuntu. But I can't find any "step-by-step" instruction or comprehensive info about it.

I'm not familiar with java and hadn't experience with creating apps for Linux.

So the main questions are:

  1. What is a standard auto-update process using distribution's package manager? Who should do download and install update and restart an app.
  2. What are another ways to solve the issue. What is the best practise to create custom update?
  3. What are the differences between .deb, .rpm packages and what are the differences between Ubuntu and Fedora?

All information will be helpful, even the it (info) will not be related to electron app.

like image 882
Gleb Avatar asked Jun 30 '16 17:06

Gleb


People also ask

How do I automatically update my electron app?

Open Source Apps - update.electronjs.org Open Source apps hosted on github.com can use a free auto update service from the Electron team, update.electronjs.org . To use this with Forge, set up the GitHub publisher and add the update-electron-app module to your app.

Does electron app work on Linux?

Electron is a framework for building cross-platform desktop applications with JavaScript, HTML and CSS. Because it is cross-platform, we can run the app in Windows, macOS, and Linux operating systems.

How often does electron update?

If you already have an electron project, then you can skip the previous article and continue from this one. Before starting the development, I would like to explain the flow. With auto updater, the app will check updates from Github every 10 minutes.

How do I create an electron app for Windows in Linux?

To build app for Windows on Linux:Install Wine (2.0+ is required) — see WineHQ Binary Packages. Install Mono (4.2+ is required) if you want to use Squirrel. Windows (NSIS, default target, doesn't require mono).


2 Answers

You can try electron-simple-updater if AppImage format is ok for your project.

like image 90
Alexey Prokhorov Avatar answered Oct 04 '22 20:10

Alexey Prokhorov


Appimages

You can use electron-builder to create Appimages to install or auto-update you application almost in any Linux distribution

AppImage is a universal software package format. By packaging the software in AppImage, the developer provides just one file ‘to rule them all’. End user, i.e. you, can use it in most (if not all) modern Linux distributions

If you want to auto-update your app you will also need electron-autoupdater. Targets:

  • MacOS: DMG.
  • Linux: AppImage
  • Windows: NSIS

You can find an example of a project that uses this here. The important files: package.json, updater.js, updater_renderer.js

With some of these instruction you can create the installers:

yarn electron-builder --linux --x64
yarn dist_linux                        # shortcut in package.json

deb, rpm

You can create packages such as deb or rpm with electron-builder, but to autoupdate them depends on how you distribute them as Jens says in his answer. The final user may need to add an apt repository to keep up to date

like image 24
ChesuCR Avatar answered Oct 04 '22 19:10

ChesuCR