12

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.

ChesuCR
  • 9,352
  • 5
  • 51
  • 114
Gleb
  • 1,312
  • 3
  • 18
  • 36

4 Answers4

7

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.

Community
  • 1
  • 1
Jens Habegger
  • 5,266
  • 41
  • 57
  • Ok, thanks. As I understood - it's a normal practice to create a custom auto-update mechanism, isn't it? – Gleb Jul 01 '16 at 08:15
  • You will at least have to target each Linux Distribution individually, some of them may have custom auto-update routines. – Jens Habegger Jul 01 '16 at 10:38
  • Nope. Best way is to create package. When you release update, put it in repository and let user decide when and how he will update the application. – msuchy Jul 01 '16 at 12:16
  • 1
    It depends on requirements. In my current project it is __required__ to have application updated as soon as new build is available on server. In this case it is not considered that user may decide to update or not to update. Yep, it is not usual desktop application, but rather corporate one. – Sneg Nov 10 '16 at 19:05
7

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

ChesuCR
  • 9,352
  • 5
  • 51
  • 114
3

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.

msuchy
  • 5,162
  • 1
  • 14
  • 26
3

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

Alexey Prokhorov
  • 3,431
  • 1
  • 22
  • 25