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

Allow specifying target binary via cli #23

Open
asdil12 opened this issue Oct 24, 2023 · 3 comments
Open

Allow specifying target binary via cli #23

asdil12 opened this issue Oct 24, 2023 · 3 comments

Comments

@asdil12
Copy link
Member

asdil12 commented Oct 24, 2023

When changing the setting of a binary, currently only the priority can be specified.
It would be better to allow specifying the target binary - at least additionally.
eg:

alts -n flask -b /usr/bin/foo

This would also allow specifying a target binary that is not actually an alternative announced by a package.

@AdamMajer
Copy link
Member

This would break the basic assumption of libalternatives which is that the defaults are provided by packages at install time. The purpose of libalternatives is then to switch between these pre-installed alternatives. You should then never up up with situation like error: No such file or directory that could happen with update-alternatives when you rollback to previous installation after an update.

So I would say this is out-of-scope.

The best way is to add the alternative to the package. It's just a simple text file. For example for one alternative for /usr/bin/node,

> cat /usr/share/libalternatives/node/12.conf
binary=/usr/bin/node12
man=node12.1

Or you can hack it locally by adding this type of file into the filesystem. This will break if you ever uninstall the package providing this binary, but it would be similar by hardcoding the binary.

@asdil12
Copy link
Member Author

asdil12 commented Oct 24, 2023

At least we could cover the use case of allowing to specify the target by alternatively passing the binary instead of the prio, which allows user readable commands.
Then alts can still (when storing the updated override) internally lookup the candidate with the matching binary entry and store the configuration using the priority.

@AdamMajer
Copy link
Member

Thanks for clarification. Basically, instead of doing

alts -n node -p 12

allow for

alts -n node -b /usr/bin/node12

and it would be equivalent result.

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

2 participants