Skip to content

Commit

Permalink
Add enabling extra repo for RHEL 7
Browse files Browse the repository at this point in the history
  • Loading branch information
tnederlof committed Sep 28, 2023
1 parent 26c41fb commit 0940e4c
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion internal/operatingsystem/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func InstallPrereqs(osType config.OperatingSystem) error {
if GdebiCoreErr != nil {
return fmt.Errorf("InstallGdebiCore: %w", GdebiCoreErr)
}
} else if osType == config.Redhat9 || osType == config.Redhat8 || osType == config.Redhat7 {
} else if osType == config.Redhat9 || osType == config.Redhat8 {
// Enable the Extra Packages for Enterprise Linux (EPEL) repository
EnableEPELErr := EnableEPELRepo(osType)
if EnableEPELErr != nil {
Expand All @@ -38,6 +38,26 @@ func InstallPrereqs(osType config.OperatingSystem) error {
if EnableCodeReadyErr != nil {
return fmt.Errorf("EnableCodeReadyRepo: %w", EnableCodeReadyErr)
}
} else if osType == config.Redhat7 {
// Enable the Extra Packages for Enterprise Linux (EPEL) repository
EnableEPELErr := EnableEPELRepo(osType)
if EnableEPELErr != nil {
return fmt.Errorf("EnableEPELRepo: %w", EnableEPELErr)
}
// Enable the Extras Repo
err := EnableExtraRepo()
if err != nil {
return fmt.Errorf("EnableExtraRepo: %w", err)
}
// Enable the CodeReady Linux Builder repository
OnCloud, err := PromptCloud()
if err != nil {
return fmt.Errorf("PrompOnPremCloud: %w", err)
}
EnableCodeReadyErr := EnableCodeReadyRepo(osType, OnCloud)
if EnableCodeReadyErr != nil {
return fmt.Errorf("EnableCodeReadyRepo: %w", EnableCodeReadyErr)
}
} else {
return errors.New("unsupported operating system")
}
Expand Down Expand Up @@ -137,6 +157,18 @@ func EnableCodeReadyRepo(osType config.OperatingSystem, CloudInstall bool) error
return nil
}

// Enable the Extra Repo
func EnableExtraRepo() error {
extraCommand := "yum-config-manager --enable rhel-7-server-rhui-extras-rpms"
commandOutput, err := system.RunCommandAndCaptureOutput(extraCommand, true, 1, true)
if err != nil {
return fmt.Errorf("issue enabling extra repo with the command '%s': %w", commandOutput, err)
}

system.PrintAndLogInfo("\nThe Extra Repository has been successfully enabled!")
return nil
}

// Enable the Extra Packages for Enterprise Linux (EPEL) repository
func EnableEPELRepo(osType config.OperatingSystem) error {
var EPELURL string
Expand Down

0 comments on commit 0940e4c

Please sign in to comment.