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
Consider upstream-release
to detect operating system
#5414
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution. Left some comments. Afterwards we can merge it I think.
scripts/functions/detect/system
Outdated
@@ -21,7 +21,11 @@ __rvm_detect_system() | |||
|
|||
_system_type="Linux" | |||
|
|||
if [[ -f /etc/lsb-release ]] && __rvm_detect_system_from_lsb_release | |||
if [[ -f /etc/upstream-release/lsb-release ]] && __rvm_detect_system_from_lsb_release upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should implement it the other way around. First check the lsb_release
and only when it returns 1
(fails), check the upstream-release
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with that is lsb_release is also present in OS with upstream_release (i.e. mint), so it would enter that path returning incorrect value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point. If mint
follows ubuntu, maybe we should just delete requirements/mint
and remove it from lsb_release/__rvm_detect_system_from_lsb_release
? This way __rvm_detect_system()
would return 1
and the proposed check on upstream-release
would work correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, sorry for late response, I was out of home.
Mmmm, I don't know the implications of doing that, I don't know the code of rvm very well (I'm new to rvm code), if you think that's the way then I'll change the code as suggested
@@ -2,7 +2,11 @@ | |||
|
|||
__rvm_detect_system_from_lsb_release() | |||
{ | |||
local __system_name="$( awk -F'=' '$1=="DISTRIB_ID"{print $2}' /etc/lsb-release | head -n 1 | tr '[A-Z]' '[a-z]' | tr -d \" )" | |||
local __lsb_release_file="" | |||
if [ -n "$1" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be more explicit here and compare against upstream
.
upstream-release
to detect operating system
740b308
to
26f946a
Compare
…istribution Update CHANGELOG.md Co-authored-by: Piotr Kuczynski <piotr.kuczynski@gmail.com> Applied changes as suggested
I think I have updated the code as suggested. I have tested the execution using linux mint 21.2. I didn't remove the file
|
Fixes #3053
Changes proposed in this pull request: