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

Parse os-release to identify OS by ID_LIKE field (i.e. make install-dependencies.sh work on Amazon Linux 2023) #3155

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stewartsmith
Copy link

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

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: actions#2511
Signed-off-by: Stewart Smith <trawets@amazon.com>
@stewartsmith stewartsmith requested a review from a team as a code owner February 16, 2024 15:30
@stewartsmith
Copy link
Author

After reading the comments in #2511 more closely, this Pull Request probably also fixes the Amazon Linux 2 issue mentioned there, as it has ID_LIKE="centos rhel fedora" which would get matched.

@softlberton
Copy link

LFG !!!

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

Successfully merging this pull request may close these issues.

Runner (v2.303) not working on AmazonLinux2023 due to missing ICU package
3 participants