Parse os-release to identify OS by ID_LIKE field (i.e. make install-dependencies.sh
work on Amazon Linux 2023)
#3155
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.
The /etc/os-release file has evolved over the years, with current documentation being at
https://www.freedesktop.org/software/systemd/man/latest/os-release.html
Part of this spec is to also look at /usr/lib/os-release as image based Linux distributions that can exist without anything in /etc may put the os-release file there.
In the docs, Example 3 shows how to parse this file with shell. We can use that example and look at ID_LIKE to better determine if the OS is a Debian like system, or a Fedora like system, and differentiate between how RHEL / CentOS and friends are like Fedora and how non-RHEL, non-CentOS is also like Fedora.
The practical end-outcome of this is that it will now correctly detect Amazon Linux 2023, pick 'dnf' as the package manager, and install the dependencies.
Fixes: #2511