Add RHEL9 support

This commit is contained in:
Jan Safranek 2023-06-08 12:13:44 +02:00
parent 36334f41ba
commit 9ce9aa754a
5 changed files with 28 additions and 1 deletions

View File

@ -326,7 +326,7 @@ func (_ *Package) RenderLocal(t *local.LocalTarget, a, e, changes *Package) erro
args = []string{"apt-get", "install", "--yes", "--no-install-recommends"}
env = append(env, "DEBIAN_FRONTEND=noninteractive")
} else if d.IsRHELFamily() {
if d == distributions.DistributionRhel8 || d == distributions.DistributionRocky8 {
if d == distributions.DistributionRhel8 || d == distributions.DistributionRocky8 || d == distributions.DistributionRhel9 {
args = []string{"/usr/bin/dnf", "install", "-y", "--setopt=install_weak_deps=False"}
} else {
args = []string{"/usr/bin/yum", "install", "-y"}

View File

@ -49,6 +49,7 @@ var (
DistributionAmazonLinux2 = Distribution{packageFormat: "rpm", project: "amazonlinux2", id: "amazonlinux2", version: 0}
DistributionAmazonLinux2023 = Distribution{packageFormat: "rpm", project: "amazonlinux2023", id: "amzn", version: 2023}
DistributionRhel8 = Distribution{packageFormat: "rpm", project: "rhel", id: "rhel8", version: 8}
DistributionRhel9 = Distribution{packageFormat: "rpm", project: "rhel", id: "rhel9", version: 9}
DistributionRocky8 = Distribution{packageFormat: "rpm", project: "rocky", id: "rocky8", version: 8}
DistributionFlatcar = Distribution{packageFormat: "", project: "flatcar", id: "flatcar", version: 0}
DistributionContainerOS = Distribution{packageFormat: "", project: "containeros", id: "containeros", version: 0}

View File

@ -82,6 +82,9 @@ func FindDistribution(rootfs string) (Distribution, error) {
if strings.HasPrefix(distro, "rhel-8.") {
return DistributionRhel8, nil
}
if strings.HasPrefix(distro, "rhel-9.") {
return DistributionRhel9, nil
}
if strings.HasPrefix(distro, "rocky-8.") {
return DistributionRocky8, nil
}

View File

@ -99,6 +99,11 @@ func TestFindDistribution(t *testing.T) {
err: nil,
expected: DistributionRhel8,
},
{
rootfs: "rhel9",
err: nil,
expected: DistributionRhel9,
},
{
rootfs: "rocky8",
err: nil,

View File

@ -0,0 +1,18 @@
NAME="Red Hat Enterprise Linux"
VERSION="9.1 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.1"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.1 (Plow)"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/9/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_BUGZILLA_PRODUCT_VERSION=9.1
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.1"