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

add RSPM code detection for CentOS/RHEL/Fedora #81

Merged
merged 3 commits into from
Sep 20, 2020

Conversation

Enchufa2
Copy link
Contributor

We need:

  • centos7 for CentOS 7 and RHEL 7.
  • centos8 for CentOS 8, RHEL 8 and all Fedora.

@eddelbuettel
Copy link
Owner

eddelbuettel commented Sep 20, 2020

Nice. Looks promising. Now:

  1. I have asked you this before, and I actually meant it. It would be awfully nice if you could follow the habit of issue tickets before unannounced pull request.

  2. Can you please do a cat /etc/os-version on one or two of those systems?

@Enchufa2
Copy link
Contributor Author

Nice. Looks promising. Now:

  1. I have asked you this before, and I actually meant it. It would be awfully nice if you could follow the habit of issue tickets before unannounced pull request.

And I have it in mind, but I thought that "Could you help me for Fedora and maybe CentOS?" and a link to this file was an invitation to this.

  1. Can you please do a cat /etc/os-version on one or two of those systems?
  • CentOS 7
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
  • CentOS 8
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"
  • Fedora
NAME=Fedora
VERSION="31 (Thirty One)"
ID=fedora
VERSION_ID=31
VERSION_CODENAME=""
PLATFORM_ID="platform:f31"
PRETTY_NAME="Fedora 31 (Thirty One)"
ANSI_COLOR="0;34"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:31"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f31/system-administrators-guide/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=31
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=31
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"

@eddelbuettel
Copy link
Owner

Awesome. With that I suggest we a) reorder and b) shorten. Mocked code (about to go running, a few hours later than I meant)

    if ("VERSION_CODENAME" %in% rownames(osrel))
        code <- osrel["VERSION_CODENAME", "value"]
    else if ("REDHAT_SUPPORT_PRODUCT" %in% rownames(osrel)) {
        # 'centos7' for CentOS/RHEL 7, 'centos8' for CentOS/RHEL 8 and Fedora
        ver <- osrel["REDHAT_SUPPORT_PRODUCT_VERSION", "value"])
        code <- paste0("centos", if (ver=="7") 7 else ver)
    }

@Enchufa2
Copy link
Contributor Author

Note that VERSION_CODENAME is in Fedora's output, but it's empty, so this order won't work.

@eddelbuettel
Copy link
Owner

eddelbuettel commented Sep 20, 2020

Thanks that's why I suggested the output and that is what I looked for -- must have missed it. But I was just out running and realized that in the fedora we put '32' in there. The else may need to be '8'.

Edit And looking at your patch I see you reflect that.

@eddelbuettel eddelbuettel merged commit 131a401 into eddelbuettel:master Sep 20, 2020
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.

2 participants