config: prioritize ::OS_VERSION
On the [beta Bluefin LTS](https://docs.projectbluefin.io/lts), `brew config` reports: ```console OS: CentOS Stream release 10 (Coughlan) ``` This is due to the `/etc/redhat-release` file being prioritized over `::OS_VERSION` (`PRETTY_NAME` from `/etc/os-release`). On Bluefin LTS, `PRETTY_NAME` is `Bluefin LTS`. This commit reverses the order so `brew config` has better detection: ``` OS: Bluefin LTS ``` I tested on RHEL 10 and the OS line only changed in that the word "release" was omitted: ``` $ cat /etc/redhat-release Red Hat Enterprise Linux release 10.0 (Coughlan) $ grep PRETTY_NAME /etc/os-release PRETTY_NAME="Red Hat Enterprise Linux 10.0 (Coughlan)" ``` - This is an improvement on my previous PR https://github.com/Homebrew/brew/pull/15788
This commit is contained in:
parent
3bec1171ce
commit
ce8ae46054
@ -29,10 +29,10 @@ module OS
|
|||||||
else
|
else
|
||||||
"#{description} (#{codename})"
|
"#{description} (#{codename})"
|
||||||
end
|
end
|
||||||
elsif (redhat_release = Pathname.new("/etc/redhat-release")).readable?
|
|
||||||
redhat_release.read.chomp
|
|
||||||
elsif ::OS_VERSION.present?
|
elsif ::OS_VERSION.present?
|
||||||
::OS_VERSION
|
::OS_VERSION
|
||||||
|
elsif (redhat_release = Pathname.new("/etc/redhat-release")).readable?
|
||||||
|
redhat_release.read.chomp
|
||||||
else
|
else
|
||||||
"Unknown"
|
"Unknown"
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user