@@ -131,24 +131,26 @@ func (c *CentOS) CheckExistingInstallation() (bool, error) {
131131
132132func (c * CentOS ) CheckOSPackages () (bool , error ) {
133133
134- var rhel8 , rocky9 bool
134+ var rhel8 , rocky9 , rhel9 bool
135135 errLines := []string {packageInstallError }
136136 zap .S ().Debug ("Checking OS Packages" )
137137
138138 rhel8 , _ = regexp .MatchString (`.*8\.([5-9]|1[0])\.*` , string (version ))
139139 rocky9 , _ = regexp .MatchString (`.*9\.[1-5]\.*` , string (version ))
140+ rhel9 , _ = regexp .MatchString (`.*9\.8\.*` , string (version ))
140141
141142 if platform .SkipOSChecks {
142143 rhel8 , _ = regexp .MatchString (`8\.\d{1,2}` , string (version ))
143144 rocky9 , _ = regexp .MatchString (`9\.\d{1,2}` , string (version ))
145+ rhel9 , _ = regexp .MatchString (`9\.\d{1,2}` , string (version ))
144146 }
145147 for _ , p := range packages {
146- if ! centos && (rhel8 || rocky9 ) {
148+ if ! centos && (rhel8 || rocky9 || rhel9 ) {
147149 switch p {
148150 case "policycoreutils-python" :
149151 if rhel8 {
150152 p = "python3-policycoreutils"
151- } else if rocky9 {
153+ } else if rocky9 || rhel9 {
152154 p = "policycoreutils-python-utils"
153155 }
154156
@@ -179,13 +181,15 @@ func (c *CentOS) CheckOSPackages() (bool, error) {
179181
180182func (c * CentOS ) CheckEnabledRepos () (bool , error ) {
181183
182- var centos , rhel8 bool
184+ var centos , rhel8 , rhel9 bool
183185 centos , _ = regexp .MatchString (`.*7\.[3-9]\.*` , string (version ))
184186 rhel8 , _ = regexp .MatchString (`.*8\.([5-9]|1[0])\.*` , string (version ))
187+ rhel9 , _ = regexp .MatchString (`.*9\.8\.*` , string (version ))
185188
186189 if platform .SkipOSChecks {
187190 centos , _ = regexp .MatchString (`7\.\d{1,2}` , string (version ))
188191 rhel8 , _ = regexp .MatchString (`8\.\d{1,2}` , string (version ))
192+ rhel9 , _ = regexp .MatchString (`9\.\d{1,2}` , string (version ))
189193 }
190194
191195 output , err := c .exec .RunWithStdout ("bash" , "-c" , "yum repolist" )
@@ -213,6 +217,14 @@ func (c *CentOS) CheckEnabledRepos() (bool, error) {
213217 if ! strings .Contains (string (output ), "AppStream" ) {
214218 enable_repos = append (enable_repos , "rhel-8-for-x86_64-appstream-rpms" )
215219 }
220+ } else if rhel9 {
221+ command = "subscription-manager repos --enable %s"
222+ if ! strings .Contains (string (output ), "BaseOS" ) {
223+ enable_repos = append (enable_repos , "rhel-9-for-x86_64-baseos-rpms" )
224+ }
225+ if ! strings .Contains (string (output ), "AppStream" ) {
226+ enable_repos = append (enable_repos , "rhel-9-for-x86_64-appstream-rpms" )
227+ }
216228 }
217229
218230 for _ , r := range enable_repos {
@@ -379,7 +391,7 @@ func (c *CentOS) Version() (string, error) {
379391 return "redhat" , nil
380392 }
381393 }
382- if match , _ := regexp .MatchString (`.*7\.[3-9]\.*|.*8\.([5-9]|1[0])\.*|.*9\.[1-5]\.*` , string (version )); match {
394+ if match , _ := regexp .MatchString (`.*7\.[3-9]\.*|.*8\.([5-9]|1[0])\.*|.*9\.( [1-5]|8) \.*` , string (version )); match {
383395 return "redhat" , nil
384396 }
385397 return "" , fmt .Errorf ("Unable to determine OS type: %s" , string (version ))
0 commit comments