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

Use update-alternatives in Linux to avoid direct symlinks #7500

Closed
markizano opened this issue Mar 25, 2023 · 2 comments
Closed

Use update-alternatives in Linux to avoid direct symlinks #7500

markizano opened this issue Mar 25, 2023 · 2 comments

Comments

@markizano
Copy link
Contributor

  • Electron-Builder Version: 24.1.1
  • Node Version: Any (current=14.21.3)
  • Electron Version: Any (current=23.2.0)
  • Electron Type (current, beta, nightly): Current
  • Electron-Updater version: N/A
  • Target: Linux (apt/DEB based)

What is the summary of the issue?

Electron app builder library should produce an app that leverages update-alternatives when installing software to Linux.

What is the expected results?

When compiling an app using app-builder-lib, it should produce a packaged result that uses update-alternatives so userland developers can assign a higher priority alternatives that middleware software may want to run/override later.

What is the actual results?

This library creates a hardcoded symlink to the binary executable when installing software. As a result, if a userland software wants a different script to execute in place of the binary, it'll get overwritten on each update.

What is an example of what you are seeking?

Example: signal-desktop

Each time I run sudo apt update to upgrade the software, I find myself needing to also update-alternatives immediately after to restore the symlinks I have created in /usr/bin/signal-desktop.

If this change is accepted, then I can simply set a higher priority script once and not need to worry about this maintenance on my system. This is also non-impactful enough to be accepted without much after-effects as a result of the change.

If update-alternatives is not available, then as a fallback, it will continue to use the symlink approach as before so there won't be any misses to existing desired functionality.

There are a few Electron-based apps that I use this would improve, so I figured I'd come to the source for a solution. Signal Desktop is just one of the few apps I would think this library update would help.

I have a Pull Request I will submit along with this ticket for a fix I hope is quickly reviewed and accepted without much of issues.

markizano added a commit to markizano/electron-builder that referenced this issue Mar 25, 2023
…inks to executable if available.

Where possible, use `update-alternatives` instead to avoid hardcoding links in Linux.
This will allow for downstream users to specify paths to their own executables
with higher priority if they wish.

Backwards compatibility is preserved by still using the symlinking route if
the command `update-alternatives` is not available.
@markizano
Copy link
Contributor Author

I have opened PR #7501 for a fix to this issue and it's ready for review =)

mmaietta pushed a commit that referenced this issue Apr 7, 2023
* Issue #7500: Use update-alternatives instead of symlinks to executable if available.

Where possible, use `update-alternatives` instead to avoid hardcoding links in Linux. This will allow for downstream users to specify paths to their own executables with higher priority if they wish.

Backward compatibility is preserved by still using the symlinking route if the command `update-alternatives` is not available.
@markizano
Copy link
Contributor Author

PR Merged into master.

Now Electron based apps will use update-alternatives if present and remove the old symlink method if it was previously set on future installs.

Thanks much to the team for helping get this resolved!

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

No branches or pull requests

1 participant