-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix: Use update-alternatives
instead of symlinks for #7500
#7501
Merged
mmaietta
merged 10 commits into
electron-userland:master
from
markizano:update-alternatives
Apr 7, 2023
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
93f81a1
Issue #7500: Use update-alternatives instead of symlinks to executabl…
markizano 663a57d
Adding changeset.
markizano bb6dbe8
husky: This came as a side effect of trying to commit.
markizano 33fac7b
Merge remote-tracking branch 'upstream/master' into update-alternatives
markizano bce9606
If you use optionalDependencies instead, npm install works on Linux w…
markizano 67b0dd4
Adding the results of the test since they changed these files.
markizano 1a45b6c
Revert change from bce960618d144e5e327b9d2213353f2ae3025c31
markizano 6eff1a0
Updated changeset and proposed change to avoid errors and easier cons…
markizano 4097817
We need to continue to consider if update-alternatives is not present…
markizano ea5c970
Update snapshot after running test suite.
markizano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
"app-builder-lib": patch | ||
--- | ||
|
||
Use `update-alternatives` when available. | ||
|
||
## What is changing? | ||
Test for `update-alternatives` in DEB based installations and use this whenever possible. | ||
In this way, middleware and downstream projects and users can specify binaries of their | ||
own priority that would override this programs' configured executable. | ||
|
||
## Why is this changing? | ||
Personally, I don't want apps running as myself or a privileged user in my system. | ||
For this. I have a shell that is executed to drop permissions first, then execute the | ||
selected software. | ||
Electron apps don't conform to this since they link directly rather than using a linking | ||
system. | ||
|
||
This change is to ensure that system is used before resorting to direct links. | ||
|
||
## How should this be consumed? | ||
Simply update as normal and this package will switch to using update-alternatives. | ||
This will allow middleware and end-users to better control the active executable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
#!/bin/bash | ||
|
||
# Delete the link to the binary | ||
rm -f '/usr/bin/${executable}' | ||
if type update-alternatives >/dev/null 2>&1; then | ||
update-alternatives --remove '${executable}' '/usr/bin/${executable}' | ||
else | ||
rm -f '/usr/bin/${executable}' | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what this line means, but I trust 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries :)
https://ss64.com/bash/test.html
-L
- file is symlink.EXPR -a EXPR
- AND operation between expressions.-e
- check if file exists.Should result in something like (pseudo code ahead):