Replies: 4 comments 1 reply
-
I could not determine any immediately actionable items from the original request on #1557 easily, so I decided to convert it into an idea discussion for now. I'd like to better understand what exactly is hoped to be achieved with this before deciding on todos. First thoughtsCurrently
At some place(s) Rex might also need to normalize one or more variations of these values to correctly map them into OS-specific modules (mainly for package and/or service manipulation). I wonder where we could collect all the possible content variations from different distros? Is there a good information source about which distro uses what strings? Or even better, examples of some other software handling (It might be possible to get around that question by decoupling the package/service provider choosing logic from distro information discovery, for example by detecting package/service managers directly, but that feels like a larger rework at this point.) |
Beta Was this translation helpful? Give feedback.
-
Did some extra research about os-release files, and wanted to answer some of my own questions from above for the person wanting to hack around this topic:
There are a couple of repos collecting file samples from various distros, for example: edit: one of them also note that "The fields in /etc/os-release are standardized, but the values are not."
There's Sys::OsRelease on CPAN for getting some ideas. This module doesn't seem to accept raw os-release content as input for parsing (yet?), and doesn't seem to be packaged for many distros (yet?), which limits its immediate usability as a local or remote dependency of Rex. Some further notes to consider:
|
Beta Was this translation helpful? Give feedback.
-
@djzort: thanks for the interesting suggestion! 👍 The idea to parse os-release files is an internal implementation detail. It is certainly worth considering for future development, but I don't yet see what exactly we wish to solve by working on this. Some of my questions so far:
|
Beta Was this translation helpful? Give feedback.
-
I came upon this when automating development environment creation across a range of distros including centos, rocky, alma, debian, ubuntu, opensuse etc in lxc containers on proxmox. I found that until lsb_release was installed on the opensuse environment rex was unable to determine what os it is. Which led me to poke around in the guts of both proxmox and rex to see what was going on. Proxmox is using os-release as its first way to detect the OS and then falls back to lsb-release then many of the ways that rex does. https://github.com/proxmox/pve-container/blob/master/src/PVE/LXC/Setup.pm also in inxi you can observe os-release being examined https://github.com/smxi/inxi What is particularly interesting about os-release is the "ID_LIKE" field which helps with distros that are derived from "mainstream" distros. For example here is one from Rocky
and similarly on Alma
In both cases they are redhat clones and function like centos prior to it becoming centos stream. Both respond to Rex's is_redhat() probe but that's not very subtle. There are other examples in the chef repo you have linked. For example raspbian is like Debian. Elementary is like ubuntu and so is linux mint. So checking os-releases first would be a quick and deterministic first check. It would also allow implementing like_xyz() functions in addition to is_xyz() which would be more subtle |
Beta Was this translation helpful? Give feedback.
-
As
me
I would like to
suggestion
so I can
identify more linux distros more accurately
Additional context
No response
Describe the solution you would like
The /etc/os-release file now seems to have wide support, my suggestion is to use it to identify more distributions.
https://www.linux.org/docs/man5/os-release.html
Describe alternatives you have considered
No response
Beta Was this translation helpful? Give feedback.
All reactions