1
0

fix: containers update

This commit is contained in:
dump_stack() 2024-06-06 12:59:04 +00:00
parent 75dd8f4a51
commit d3a575e5e3
Signed by: dump_stack
GPG Key ID: C9905BA72B5E02BB
7 changed files with 20 additions and 28 deletions

View File

@ -172,7 +172,7 @@ func (cmd *KernelCmd) fetchContainerCache(c container.Container) {
if !cmd.ContainerCache { if !cmd.ContainerCache {
return return
} }
if c.Exist() { if c.Exist() && container.UseCache {
return return
} }

View File

@ -241,6 +241,10 @@ func (c Container) Exist() (yes bool) {
} }
func (c Container) Build(image string, envs, runs []string) (err error) { func (c Container) Build(image string, envs, runs []string) (err error) {
if c.Exist() && UseCache {
return
}
cdir := dotfiles.Dir("containers", c.name) cdir := dotfiles.Dir("containers", c.name)
cfile := filepath.Join(cdir, "Dockerfile") cfile := filepath.Join(cdir, "Dockerfile")

View File

@ -37,13 +37,10 @@ func (centos CentOS) Packages() (pkgs []string, err error) {
return return
} }
if !c.Exist() { err = c.Build("centos:"+centos.release, centos.envs(), centos.runs())
err = c.Build("centos:"+centos.release,
centos.envs(), centos.runs())
if err != nil { if err != nil {
return return
} }
}
cmd := "yum search kernel --showduplicates 2>/dev/null " + cmd := "yum search kernel --showduplicates 2>/dev/null " +
"| grep '^kernel-[0-9]' " + "| grep '^kernel-[0-9]' " +

View File

@ -54,12 +54,10 @@ func (d Debian) Packages() (packages []string, err error) {
return return
} }
if !c.Exist() {
err = c.Build(d.image(), d.envs(), d.runs()) err = c.Build(d.image(), d.envs(), d.runs())
if err != nil { if err != nil {
return return
} }
}
kernels, err := GetKernels() kernels, err := GetKernels()
if err != nil { if err != nil {

View File

@ -70,12 +70,10 @@ func (suse OpenSUSE) Packages() (pkgs []string, err error) {
name = "opensuse/leap:" + suse.release name = "opensuse/leap:" + suse.release
} }
if !c.Exist() {
err = c.Build(name, suse.envs(), suse.runs()) err = c.Build(name, suse.envs(), suse.runs())
if err != nil { if err != nil {
return return
} }
}
cmd := "zypper search -s --match-exact kernel-default | grep x86_64 " + cmd := "zypper search -s --match-exact kernel-default | grep x86_64 " +
"| cut -d '|' -f 4 | sed 's/ //g'" "| cut -d '|' -f 4 | sed 's/ //g'"

View File

@ -38,13 +38,10 @@ func (ol OracleLinux) Packages() (pkgs []string, err error) {
return return
} }
if !c.Exist() { err = c.Build("oraclelinux:"+ol.release, ol.envs(), ol.runs())
err = c.Build("oraclelinux:"+ol.release,
ol.envs(), ol.runs())
if err != nil { if err != nil {
return return
} }
}
if ol.release == "8" { if ol.release == "8" {
// Image for ol9 is required for some kernels // Image for ol9 is required for some kernels

View File

@ -43,12 +43,10 @@ func (u Ubuntu) Packages() (pkgs []string, err error) {
return return
} }
if !c.Exist() {
err = c.Build("ubuntu:"+u.release, u.envs(), u.runs()) err = c.Build("ubuntu:"+u.release, u.envs(), u.runs())
if err != nil { if err != nil {
return return
} }
}
cmd := "apt-cache search " + cmd := "apt-cache search " +
"--names-only '^linux-image-[0-9\\.\\-]*-generic$' " + "--names-only '^linux-image-[0-9\\.\\-]*-generic$' " +