Gleb
Gleb

Reputation: 1332

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.

Upvotes: 13

Views: 11854

Answers (4)

ChesuCR
ChesuCR

Reputation: 9670

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

Upvotes: 8

Alexey Prokhorov
Alexey Prokhorov

Reputation: 3941

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

Upvotes: 3

msuchy
msuchy

Reputation: 5447

Answer from Jens is really the best.

But if you do not want to spend your time with learning RPM and DEB and building packages for all distribution, then you may consider package your application using Flatpak. http://flatpak.org/#about

It create one big archive which can be run on Ubuntu, RHEL.... Everywhere.

Upvotes: 3

Jens Habegger
Jens Habegger

Reputation: 5446

There really is nothing standard in the *nix world. You will always have to support specific ditributions, and each of these distribution can in turn have multiple possible ways of creating an auto-updater.

To your questions:

  1. There is no standard way.

  2. That depends on your way of actually distributing he package. If you plan on using package managers like rpm/apt-get/apt install, then each of these managers has a specific way of configuring your application to be among those packages that are checked for automatic updates.

  3. Difference between .rpm / .deb:

    Main difference for a package maintainer (I think that would be 'developer' in Debian lingo) is the way package meta-data and accompanying scripts come together. Link

    Difference between Ubuntu & Fedora: As creating a detailed answer on this questions would both be too lengthy and too much effort to maintain, check out this blog post detailing the differences between these two distributions.

Upvotes: 7

Related Questions