refactor: move oracle linux runs/envs to module
This commit is contained in:
parent
4eed03ec2a
commit
71c2b2001c
37
distro/oraclelinux/oraclelinux.go
Normal file
37
distro/oraclelinux/oraclelinux.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package oraclelinux
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
|
"code.dumpstack.io/tools/out-of-tree/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Envs(km config.KernelMask) (envs []string) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func Runs(km config.KernelMask) (commands []string) {
|
||||||
|
cmdf := func(f string, s ...interface{}) {
|
||||||
|
commands = append(commands, fmt.Sprintf(f, s...))
|
||||||
|
}
|
||||||
|
|
||||||
|
if sk.DistroRelease < "6" {
|
||||||
|
log.Fatal().Msgf("no support for pre-EL6")
|
||||||
|
}
|
||||||
|
|
||||||
|
cmdf("sed -i 's/enabled=0/enabled=1/' /etc/yum.repos.d/*")
|
||||||
|
cmdf("sed -i 's;installonly_limit=;installonly_limit=100500;' /etc/yum.conf /etc/dnf/dnf.conf || true")
|
||||||
|
cmdf("yum -y update")
|
||||||
|
cmdf("yum -y groupinstall 'Development Tools'")
|
||||||
|
|
||||||
|
packages := "linux-firmware grubby"
|
||||||
|
if sk.DistroRelease <= "7" {
|
||||||
|
packages += " libdtrace-ctf"
|
||||||
|
}
|
||||||
|
|
||||||
|
cmdf("yum -y install %s", packages)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
@ -26,6 +26,7 @@ import (
|
|||||||
"code.dumpstack.io/tools/out-of-tree/container"
|
"code.dumpstack.io/tools/out-of-tree/container"
|
||||||
"code.dumpstack.io/tools/out-of-tree/distro/centos"
|
"code.dumpstack.io/tools/out-of-tree/distro/centos"
|
||||||
"code.dumpstack.io/tools/out-of-tree/distro/debian"
|
"code.dumpstack.io/tools/out-of-tree/distro/debian"
|
||||||
|
"code.dumpstack.io/tools/out-of-tree/distro/oraclelinux"
|
||||||
"code.dumpstack.io/tools/out-of-tree/distro/ubuntu"
|
"code.dumpstack.io/tools/out-of-tree/distro/ubuntu"
|
||||||
"code.dumpstack.io/tools/out-of-tree/fs"
|
"code.dumpstack.io/tools/out-of-tree/fs"
|
||||||
)
|
)
|
||||||
@ -179,6 +180,7 @@ func GenerateBaseDockerImage(registry string, commands []config.DockerCommand,
|
|||||||
d += "RUN " + c.Command + "\n"
|
d += "RUN " + c.Command + "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO container runs/envs interface
|
||||||
switch sk.DistroType {
|
switch sk.DistroType {
|
||||||
case config.Ubuntu:
|
case config.Ubuntu:
|
||||||
for _, e := range ubuntu.Envs(sk) {
|
for _, e := range ubuntu.Envs(sk) {
|
||||||
@ -195,19 +197,12 @@ func GenerateBaseDockerImage(registry string, commands []config.DockerCommand,
|
|||||||
d += "RUN " + c + "\n"
|
d += "RUN " + c + "\n"
|
||||||
}
|
}
|
||||||
case config.OracleLinux:
|
case config.OracleLinux:
|
||||||
if sk.DistroRelease < "6" {
|
for _, e := range oraclelinux.Envs(sk) {
|
||||||
err = fmt.Errorf("no support for pre-EL6")
|
d += "ENV " + e + "\n"
|
||||||
return
|
|
||||||
}
|
}
|
||||||
d += "RUN sed -i 's/enabled=0/enabled=1/' /etc/yum.repos.d/*\n"
|
for _, c := range oraclelinux.Runs(sk) {
|
||||||
d += "RUN sed -i 's;installonly_limit=;installonly_limit=100500;' /etc/yum.conf /etc/dnf/dnf.conf || true\n"
|
d += "RUN " + c + "\n"
|
||||||
d += "RUN yum -y update\n"
|
|
||||||
d += "RUN yum -y groupinstall 'Development Tools'\n"
|
|
||||||
packages := "linux-firmware grubby"
|
|
||||||
if sk.DistroRelease <= "7" {
|
|
||||||
packages += " libdtrace-ctf"
|
|
||||||
}
|
}
|
||||||
d += fmt.Sprintf("RUN yum -y install %s\n", packages)
|
|
||||||
case config.Debian:
|
case config.Debian:
|
||||||
for _, e := range debian.ContainerEnvs(sk) {
|
for _, e := range debian.ContainerEnvs(sk) {
|
||||||
d += "ENV " + e + "\n"
|
d += "ENV " + e + "\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user